我正在尝试在 GWT 中加载一个简单的图像。但它永远找不到。
import com.google.gwt.user.client.ui.Image;
public class ImageTest implements EntryPoint {
Image image = new Image("test.png");
}
结果:
[WARN] 404 - GET /test.png (127.0.0.1) 1394 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://127.0.0.1:8888/ImageTest.html?gwt.codesvr=127.0.0.1:9997
Response headers
Content-Type: text/html; charset=iso-8859-1
Content-Length: 1394
test.png
放置在与类相同的目录中ImageTest
。我也试着把它放在src/main/resources
. 同样的错误。
图像必须位于何处?