[英]gwt requestbuilder returns 404 NOT_FOUND error while trying to access xml-file with eclipse jetty
iam使用gwt2.4,iam嘗試使用gwt requestbuilder訪問一個簡單的xml文件。 iam使用eclipse和嵌入式碼頭服務器。
項目結構:
myfooApp戰爭person.xml
和iam使用地點和活動。
我不知道為什么,但是當我嘗試訪問xml文件時出現404錯誤。
它是標准的requestbuilder代碼。
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, GWT.getModuleBaseURL()+"/person.xml");
try{
builder.sendRequest(null, new RequestCallback() {
public void onResponseReceived(Request request, Response response) {
view.getLabel().setText(response.getText());
}
public void onError(Request request, Throwable exception) {
view.getLabel().setText("There was an error! "+exception.getMessage());
}
});
}catch(RequestException e){
view.getLabel().setText("Unable to build the request.");
}
我不確定這是否與問題有關,但GWT.getModuleBaseURL返回:127.0.0。 1:88 88 / myFooApp
但正確的網址是:12 7.0.0.1:8888/myFooApp.html?gwt.codesvr=127.0.0.1:9 997#FileDisplayPlace:side2
這個問題可能是什么原因? 以及如何解決。 非常感謝您的幫助。
GWT.getModuleBaseURL()
返回GWT生成文件的文件夾(* .nocache.js和.cache。文件所在的位置)。
如果person.xml
是HTML宿主頁(myFooApp.html)的同級,則使用GWT.getHostPageBaseURL()
。 在您的情況下,它將為http://127.0.0.1:8888
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.