简体   繁体   中英

gwt requestbuilder returns 404 NOT_FOUND error while trying to access xml-file with eclipse jetty

iam working with gwt2.4 and iam trying to access a simple xml file with the gwt requestbuilder. iam using eclipse and the embedded jetty-server.

project structure:

myfooApp war person.xml

and iam using places and activities.

i dont know why but i get an 404 error when i try to access the xml file.

its a standart requestbuilder code.

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.");
}

i am not sure if this has something to do with the problem but GWT.getModuleBaseURL returns: 127.0.0. 1:88 88/myFooApp

but the correct URL is : 12 7.0.0.1:8888/myFooApp.html?gwt.codesvr=127.0.0.1:9 997#FileDisplayPlace:side2

what could be the reason for this problem? and how could it be solved. thanks a lot for help.

GWT.getModuleBaseURL() returns the "folder" where GWT has generated the files (where the *.nocache.js and .cache. files live).

If person.xml is a sibling of your HTML Host page (myFooApp.html), then use GWT.getHostPageBaseURL() . In your case, it'll be http://127.0.0.1:8888 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM