So for some reason I skipped over that section, my bad.. Although I am glad I did, it forced me to
comb through the code and understand the process flow. Now the comment left by "PRY" makes
sense, he is referring to the class com.sun.net.httpserver.Authenticator.Result in your RemoteServiceServlet
subclass. I don't think that any of the com.sun.* classes are on the whitelist for appspot/GAE apps.
The whole problem stems around a Http Header, X-GWT-Module-Base, that is populated
in com.google.gwt.user.client.rpc.RpcRequestBuilder in this method.
protected void doFinish(RequestBuilder rb) {
rb.setHeader(STRONG_NAME_HEADER, GWT.getPermutationStrongName());
rb.setHeader(MODULE_BASE_HEADER, GWT.getModuleBaseURL());
}
I initially found a workaround by overloading the RemoteServiceServlet::doGetSerializationPolicy
with the code below. Later I was reading the JS output from the GWT Compiler and noticed that
the $moduleName and $moduleBaseURL are used throughout the code. $moduleName is used as
the ID for some elements and such.. So instead of using the server based code I decided to see if
I could fix this from the client side to make everything more legitimate. So I added two native methods
in my entry point that allows me to set those variables. Note: GWT.getModuleName() and GWT.getModuleBaseURL()
are driven from native methods in the com.google.gwt.core.client.impl.Impl class with the same name.
Methods added to my entry point class. public static native void setModuleName(String name) /*-{
$moduleName = name;
}-*/;
public static native void setModuleBaseURL(String url) /*-{
$moduleBase = url;
}-*/;
then I created a constructor in my EntryPoint class, which for me is the following
public PGMobileEntryPoint()
{
setModuleName("PicRollrMobile");
setModuleBaseURL("
http://192.168.1.250:8888/PicRollrMobile/");
m_rcp = new RemoteCommandProxy();
m_rcp.setServiceEntryPoint("
http://192.168.1.250:8888/PicRollrMobile/yavcf");
}
RemoteCommandProxy is a class I created that manages my RemoteService class.
Now it works without the Server based modification..
Also it appears that if the Module's constructor is called in the JS file, all these items
will be set up correctly which may be something that can be generically handled in
GWT Phonegap.. i.e. for me in my PicRollrMobile.nocache.js, the top of the code
sets the moduleName.. Note: I compiled in "Pretty" mode.
function PicRollrMobile(){
var $wnd_0 = window, $doc_0 = document, $stats = $wnd_0.__gwtStatsEvent?function(a){
return $wnd_0.__gwtStatsEvent(a);
}
:null, $sessionId_0 = $wnd_0.__gwtStatsSessionId?$wnd_0.__gwtStatsSessionId:null, scriptsDone, loadDone, bodyDone, base = '', metaProps = {}, values = [], providers = [], answers = [], softPermutationId = 0, onLoadErrorFunc, propertyErrorFunc;
$stats && $stats({moduleName:'PicRollrMobile', sessionId:$sessionId_0, subSystem:'startup', evtGroup:'bootstrap', millis:(new Date).getTime(), type:'begin'});
Server side method override, first attempt..protected SerializationPolicy doGetSerializationPolicy(
HttpServletRequest request, String moduleBaseURL, String strongName) {
if (moduleBaseURL.startsWith("file:"))
{
String url = request.getRequestURL().toString();
int lastSlash = url.lastIndexOf("/");
if (lastSlash != -1) url = url.substring(0, lastSlash+1);
return super.doGetSerializationPolicy(request,url, strongName);
}
else
{
return super.doGetSerializationPolicy(request,moduleBaseURL, strongName);
}
}
-John Gentilin