Made progress, but the GWTP app is acting flaky after any
deferredjs/<hash>/<number>.cache.js file is loaded. The error implied the
functions being called are not in scope. The file is loaded and the request
had the expected payload.
So, curious if anyone has run GWTP or similar split apps with the XS linker
*Steps taken to get things jiving*
1. I kicked on the XS linker in hopes code splitting would work with it.
Needs more help, but this gets around frame security warnings.
2. RPC Asyncs kept pointing to the CDN, so I added the below to the RPC
Asyncs
public static final PublicServiceAsync getInstance() {
if (instance == null) {
instance = (PublicServiceAsync) GWT.create(PublicServiceAsync.class);
ServiceDefTarget serviceDefTarget = ((ServiceDefTarget) instance);
String address = BrowserUtil.getHostpageUrl();
String oldUrl = serviceDefTarget.getServiceEntryPoint();
// if we're not local (dev) redirect to index.html URL
if (oldUrl.startsWith(GWT.getModuleBaseURL())) {
address = address + GWT.getModuleName() + "/" +
oldUrl.substring(GWT.getModuleBaseURL().length());
serviceDefTarget.setServiceEntryPoint(address);
}
}
return instance;
}
3. The RPC Async interfaces kept throwing SOP issues, so I enabled CORS on
the server side
4. Now RemoteServiceServlet is using the moduleName from the CDN url.
However this does not match the server side layout, so it fails to fetch
the *.gwt.rpc files. So I overrode RemoteServiceServlet with:
public class CustomRemoteServiceServlet extends RemoteServiceServlet {
public final static String MODULE_ALIAS = "app";
@Override
protected SerializationPolicy doGetSerializationPolicy(final
HttpServletRequest request,
final String moduleBaseURL, final String strongName) {
// true client side relative location is the app name
String newModuleBaseURL = moduleBaseURL;
try {
URL url = new URL(moduleBaseURL);
StringBuilder builder = new StringBuilder();
builder.append(url.getProtocol());
builder.append("://");
builder.append(url.getHost());
builder.append("/");
builder.append(MODULE_ALIAS);
builder.append("/");
newModuleBaseURL = builder.toString();
} catch (MalformedURLException ex) {
// we have no affect
}
return super.doGetSerializationPolicy(request, newModuleBaseURL,
strongName);
}
}
I hope that helps others attempting this, but I still need to solve that
code splitting bit, so let me know if anyone's skinned that cat before.
Thanks!
Sincerely,
Joseph
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.