I'm trying to start SuperDevMode the following way. I modified my index.jsp
page to append a configurable prefix to the .nocache.js
file. Production config contains an empty prefix, while development config contains something like http://localhost:9876
. Then I start the server on Tomcat and type localhost:8080
. GWT starts normally, but when it tries to send an RPC request, it fails, because request goes to localhost:9876
instead of localhost:8080
. How can I customize which host should RPC use to send request to?

- 1,980
- 2
- 17
- 29
1 Answers
I spent some time digging into GWT code with Eclipse and debugger, and found, that GWT RPC concatenates the result of GWT.getModuleBaseURL()
with the value of @RemoteServiceRelativePath
. Here is the code of the getModuleBaseURL
method:
public static native String getModuleBaseURL() /*-{
// Check to see if DevModeRedirectHook has set an alternate value.
// The key should match DevModeRedirectHook.js.
var key = "__gwtDevModeHook:" + $moduleName + ":moduleBase";
var global = $wnd || self;
return global[key] || $moduleBase;
}-*/;
I also examined dev_mode_on.js
and found several occurences of __gwtDevModeHook
, but none of them contained moduleBase
. Also dev_mode_on.js
install all its hooks into sessionStorage
, while getModuleBaseURL
reads from $wnd
(I used debugger and became convinced that $wnd
= window
).
So I used the following solution and it worked for me. I simply added the following into my index.jsp
:
<c:if test="${not empty gwtScriptPrefix}">
<script type="text/javascript">
window["__gwtDevModeHook:MYAPP:moduleBase"] = "MYAPP/";
</script>
</c:if>
just before
<script type="text/javascript"
src="${gwtScriptPrefix}MYAPP/MYAPP.nocache.js">
</script>
where the gwtScriptPrefix
attribute is calculated by System.getProperty
, and the corresponding system property is set to localhost:9876/
on the Eclipse running configuration.

- 1,980
- 2
- 17
- 29