is it possible to run a gwt project in hosted mode which requires a
i.e. I need to read parameters from the web.xml in init().
1. I want to use a deployment descriptor that is local to my app
because of other filters, parameters, realms, etc, apart from just GWT
servlets (for which you can create mock objects). I want that
deployment descriptor to matter in Hosted Mode.
2. I want whatever GWT service servlet entries are in my GWT module to
also be deployed automatically with my applications deployment
descriptor (automatically merged into any local web.xml) without having
to maintain the entries in two places (without having to define the
module stuff AND duplicate it in a deployment descriptor that is
deployed with the app).
Your question is the same as item 1. For that what I have been doing
is munging the web.xml that the GWT development tomcat instance uses.
tomcat\webapps\ROOT\WEB-INF\web.xml. This seems to work but it's not
ideal because it means I have to maintain the entries in the deployment
descriptor in two files (my apps web.xml which is deployed with the
app, and the GWT ROOT web.xml).
For item 2, I have been experimenting with having a build process,
Maven, inspect and merge the .gwt.xml module file servlet entries with
the applications specific web.xml. This is being enabled at present
via a GWT Maven plugin (http://code.google.com/p/gwt-maven/). I am
using the Maven 1 version of the plugin, which takes the module file
servlet entries and creates relevant servlet and servlet-mapping
entries in the deployment artifact web.xml (not in the source web.xml,
the source one has all the other stuff, init params, realms, other
servlets, so on - and it is not modified, but the final one deployed is
that source file PLUS GWT servlet entries that are added automatically
by the build/deploy process).
There certainly may be better ways to do this stuff, but I haven't run
across them yet, I think most people are just maintaining duplicate
entries in both cases. If anyone has any other ideas on this front