Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why GWT doesn´t work without ?gwt.codesvr=127.0.0.1:9997

Tags:

gwt

I would like to know why GWT doesn´t work without the argument ?gwt.codesvr=127.0.0.1:9997 in the url, I´m redirecting between modules hardcoding the url´s and I have to set this line not to be shown the message: Module XXX Must be (re) compile.

I hope not to have to change this urls in the future when I would change from host mode to we mode...

So is there any better way to link from a module to the other one? I´m doing with:

GWT.getHostPageBaseURL() + "UserRegistration.html ?gwt.codesvr=127.0.0.1:9997 "

Thanks in advance.

like image 235
migueloop Avatar asked Aug 25 '11 21:08

migueloop


1 Answers

That query-string argument is looked at by the *.nocache.js to trigger loading the dev mode plugin you installed in your browser, so it connects back to the designated DevMode app.

When you have to redirect between pages and you want them to all run either in dev mode or web mode, the easiest is to condition the argument (if possible with the value taken from the existing one, rather than hard-coded) to !GWT.isProdMode():

if (!GWT.isProdModode()) {
   // assumes 'url' doesn't contain a query-string yet
   url += "?gwt.codesvr=" + Window.Location.getParameter("gwt.codesvr");
}

If you don't use a query-string yourself, so it's only expected to ever exist with the gwt.codesvr parameter or be absent, you can make it even simpler using a UrlBuilder:

UrlBuilder builder = Window.Location.createUrlBuilder();
builder.setPath(GWT.getHostPageBaseURL() + "UserRegistration.html")
//don't pass the history token around:
builder.setHash(null);
// builder.toString() will then keep the same query string.

and it's not even conditioned to the current "mode" the app is run in, as it just, unconditionally, copies the query-string around.

like image 118
Thomas Broyer Avatar answered Oct 20 '22 12:10

Thomas Broyer