user1289877
user1289877

Reputation: 279

GWT.getHostPageBaseURL() doesn't work

I have problem with my app written in gwt and deployed on tomcat 7. The problem is that I couldn't get base url trough GWT.getHostPageBaseURL() method. I build next request:

new RequestBuilder(RequestBuilder.POST, GWT.getHostPageBaseURL() + "login");

but the result is 404 not found. The application is running in my url: 192.168.3.3:8080/myapp/
When I chenge the tomcat root context of my app to "/" than: 192.168.3.3:8080/ works fine, so I need to get "myapp" from url. Have anyone some ide how to get this part of url? I don't want to put it as literal to request builder.

Upvotes: 0

Views: 3159

Answers (2)

Abhijith Nagaraja
Abhijith Nagaraja

Reputation: 3380

You can use, GWT.getModuleBaseUrl(); It will return you the complete url your are looking for, i.e, 192.168.3.3:8080/myapp/. If you just want the module name above approach suggested by Jamshid Asatillayev would just work fine, i.e., GWT.getModuleName();

Upvotes: 3

Jama A.
Jama A.

Reputation: 16079

so I need to get "myapp" from url

Use GWT.getModuleName() which gets the name of the running module.

Upvotes: 0

Related Questions