tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Horn, Rob" <>
Subject RE: Managing a large web.xml
Date Tue, 20 Aug 2002 07:32:39 GMT

What we have implemented (thanks to whoever suggested it from here!) to
include a <context ..> section into our server.xml file is:

we have and M4 macro file server.xml.m4 in conf directory that contains ...

<!-- everything before the context entry -->
<!-- everything after the context entry -->

We have the context entry in a file context.xml also in the conf dir.

We have then placed the following onto the script in the bin dir:

m4 ../conf/server.xml.m4 > ../conf/server.xml

Our web.xml file is generated by a script from entries in a database for
servlets and servlet mappings and other file-snippets that are included.  We
have also put in place an application assembly script that compiles files,
builds the appropriate file structure, calls the script to produce web.xml
and creates a .war file.  Non of it is particularly rocket science but the
time spent creating it makes rebuilds and deployment a doddle.

Hope this helps or gives you ideas.


-----Original Message-----
From: []
Sent: 19 August 2002 23:24
To: Tomcat Users List
Subject: Re: Managing a large web.xml

From: "Milo Hyson" <>
Sent: Monday, August 19, 2002 2:36 PM

> Is there any way to break up a large web.xml file into smaller ones to
make it
> more manageable? I've found that it doesn't take that big of a project
> I have so many servlets and mappings as to make the deployment descriptor
> file quite long. I've read through the Servlet spec (2.3) and poked around
> the mailing list archives, but can't find anything like an include
> or anything else that might let me divide my descriptor into mutiple
> files. Ideally, I'd like to be able to create a different file for each
> section of the application, so that I can focus on one at a time.
> I'd appreciate any insights into this situation. Thanks in advance.

The Servlet spec isn't much help in this case.

The most practical approach is to break it up using some regular method, and
then just create the actual web.xml as part of the build/deploy process in
your build script. (For example, just before you pack everything up in a
WAR, or whatever).

I don't have any code to share with you at the moment, and I don't think
it's quite straightforward with ANT, but that's still the path I'd take.


Will Hartung

View raw message