Here is my problem. For example I have some HTML file Description.html
and it contains something like this
<p>
<img src="Bill.jpg">
</p>
Bill.jpg is in the same directory with html file.
Also I have UiBinder widget which contains SimplePanel
called panel.
In ui.xml for this widget looks like
...
<ui:style src="../Style.css"/>
<g:SimplePanel ui:field="panel" addStyleNames="{style.description}" />
...
Constructor of this widget is:
public SomeWidget() {
initWidget(uiBinder.createAndBindUi(this));
panel.setWidget(new HTMLPanel(HtmlTextResources.htmlFile().getText());
}
The point of problem - that bill.img doesn't displays. Console shows
> [WARN] 404 - GET /bill.jpg (127.0.0.1) 1373 bytes Request headers
> Host: 127.0.0.1:8888
> Connection: keep-alive
> Cache-Control: no-cache
> Accept: image/webp,*/*;q=0.8
> Pragma: no-cache
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153
> Safari/537.36
> *****************
> Accept-Encoding: gzip,deflate,sdch
> Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4,it;q=0.2,uk;q=0.2 Response
> headers
> Content-Type: text/html;charset=ISO-8859-1
> Cache-Control: must-revalidate,no-cache,no-store
> Content-Length: 1373
How I can fix this? It's neccessary to use pics via html
Any relative URLs in your GWT application are normally read relative to your WEB-INF directory (or whatever the directoy the web.xml is in is called). Not relative to the directory your HTML page lies in.
So, if you don't want to replace all the URLs in your Description.html, you should move the referenced files to WEB-INF.