Tuesday, April 21, 2015

Re: GWT web content from a Java servlet

Excellent suggestion.  I like the path info thing.  Thank you!

On Saturday, April 18, 2015 at 8:07:55 AM UTC-5, Thomas Broyer wrote:

On Friday, April 17, 2015 at 10:59:49 PM UTC+2, eho...@usdataworks.com wrote:
I've tried looking for answers to this question, but the terms are so common that I can't find anything useful.  Either that or I don't know the right term to include in my search.

My goal is to provide GWT web content (an HTML page, the nocache.js and cache.js files, etc.) all from a Java servlet.

My HTML file has a script tag that specifies the servlet (and some parameters) in its "src" attribute.  That successfully loads the nocache.js file from my servlet.

Inside the nocache.js file, though, there is a section of calls to "unflattenKeylistIntoAnswers()" that maps browser types to the generated names for the GWT javascript files.  I need to prepend my servlet name (and some parameters) to those file names so they will also be loaded from my servlet.

So instead of loading the cache.js files from 


the nocache.js file will load them from


I'm looking for some way to modify the __moduleBase added to the filename in computeUrlForResource(), or some way to redefine the functions like installCode() to change the URL for the .js file.

Any ideas?

It would be easier to use the path-info rather than a query-string parameter: map your servlet to /myservlet/* and use HttpServletRequest#getPathInfo() to get the rest of the path.

If you really want to use a query-string parameter, then you'll have to customize the selection-script, as you already noticed. Fortunately, this is made relatively easy by the CrossSiteIframeLinker: create a subclass where you override getJsComputeUrlForResource and use that as your primary linker in place of xsiframe. cf. http://www.gwtproject.org/doc/latest/DevGuideLinkers.html

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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment