-1

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.

Pero
  • 774
  • 3
  • 15
  • 34

1 Answers1

2

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.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164