Specify different web.xml filename

59 views
Skip to first unread message

levier

unread,
Apr 23, 2011, 4:27:28 AM4/23/11
to Google Web Toolkit
Hi,

Basically my question here is: how do I tell the gwt dev mode web
container (jetty at the moment) to look for another web.xml filename
when dev mode starts.


Background:
When running a GWT module in a dev mode, you can specify a -war
argument to pass different war directories.
This makes it possible to have 1 project and have totally different
modules in there. That's nice, but it becomes a hassle to maintain if
you have shared resources between those modules.

I have 1 project with 1 module 'DISC', but I want it to start it in
different modes at the same time.
So I have 2 gwt.xml modules, and use a rename-to 'DISCDEBUG' to let
GWT differentiate.

The problem with rename-to is that I also need to adapt the web.xml
and specify the new name in it on the url-pattern of the servlet-
mappings (DISC/ becomes DISCDEBUG/)

So I would like to have 1 web.xml for the production module, and
another webdebug.xml for the debug mode.
though ideally: just 1 web.xml containing a property {gwt.modulename}
or something which is replaced at startup of the webcontainer. But
support for using runtime properties in the web.xml depends on the
container implementation.


workaround:
* create separate war directories:
not usable: I would need to copy my whole 'war' directory to another
'wardebug' directory and maintain both these directories on changes.




Thomas Broyer

unread,
Apr 23, 2011, 5:22:23 AM4/23/11
to google-we...@googlegroups.com
Why aren't you simply renaming your debug module to the same name as the "production" one?

田传武

unread,
Apr 23, 2011, 5:33:36 AM4/23/11
to google-we...@googlegroups.com
maybe you can use a "-server com.google.gwt.dev.shell.jetty.OurJettyLauncher" argument to launch gwt.
below is the source of OurJettyLauncher:


package com.google.gwt.dev.shell.jetty;

import com.google.gwt.core.ext.TreeLogger;

import org.mortbay.jetty.webapp.WebAppContext;

import java.io.File;

public class OurJettyLauncher extends JettyLauncher {

	protected WebAppContext createWebAppContext(TreeLogger logger, File appRootDir) {
		WebAppContext webAppContext = super.createWebAppContext(logger, appRootDir);

		String webXmlPath = System.getProperty("webXml");
		if (webXmlPath != null && !"".equals(webXmlPath)) {
			webAppContext.setDescriptor(webXmlPath);
		} else {
			webAppContext.setDescriptor("WEB-INF/boot.web.xml");
		}
		return webAppContext;
	}

}
On Sat, Apr 23, 2011 at 5:22 PM, Thomas Broyer <t.br...@gmail.com> wrote:
>
> Why aren't you simply renaming your debug module to the same name as the "production" one?
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Reply all
Reply to author
Forward
0 new messages