GWT 1.1. removed the need for a gwt-hosted.html file. In my projects
GWT.getModuleBaseURL() now returns an empty string when used in hosted
mode with the -noserver option. The compiled code works fine in the
browser it just doesn't work in the development shell started with the
"-noserver" option.
Is this a known issue or is there a configuration workaround?
Cu, Gunnar
It's not a bug at all. It took me almost 1 hour to figure things out.
To run in -noserver mode:
1. Don't do any <servlet> mapping in .gwt.xml file or mapping without
module name
2. web.xml have to map with module name (something like
/modulename/servicename)
3. service end point must include: getModuleBaseURL() + servicename
Thanks,
hovan.
Hoven, that's not my problem.
GWT.getModuleBaseURL() in hosted with -noserver !=
GWT.getModuleBaseURL() in compiled mode
So, the resource or service works using the compiled JavaScript but not
in the hosted browser. For example, new Image(GWT.getModuleBaseURL() +
"/myimage.png") works perfect in the compiled version but does not work
in the hosted browser (because GWT.getModuleBaseURL() in an empty
string there).
Cu, Gunnar
So, what arguments to you use for launching your development shell?
<target name="run-test.hosted">
<java classname="com.google.gwt.dev.GWTShell" fork="true">
<classpath refid="gwt.classpath"/>
<classpath location="${gwtx.jar}"/>
<classpath location="${src.dir}/gwtx-test"/>
<classpath location="${build.dir}/gwtx-test/classes"/>
<arg value="-noserver"/>
<arg value="-out"/>
<arg value="${build.dir}/gwtx-test/www"/>
<arg
value="http://localhost:8080/gwtx-test/com.xp.test.gwtx.XModule/XModule.html"/>
</java>
</target>
$moduleName = mcb.getName();
$moduleBaseURL = mcb.getBaseURL();
alert('look:' + $moduleName);
alert('look:' + $moduleBaseURL);
The module name is correct. But $moduleBaseURL is empty. I think the
problem is my URL.
Maybe GWT is confused by the context URL of my webapp. ;)
Cu, Gunnar
This blank thing got fixed on 1.1.10. Now you will get
http://localhost:8888/modulename for hosted mode with or without server
option
hovan.