tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Static resource mapping in web.xml
Date Thu, 09 Jun 2011 16:43:14 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Federico,

On 6/8/2011 2:04 PM, falvarez@geocom.com.uy wrote:
> If this is the case I could make it weight-in in the matter of building a
> well formed web.xml.
> 
> Although it could take some time.

How many servlets do you have?

> Mapping each servlet to an "/*" url-pattern will avoid us from using invoker
> and at the same time get rid of "/servlet" in the URL and keep images under
> "/images".

Don't map to "/*" of course: instead map to a specific URL.

You can use some simple tools to generate the mappings. Something like this:

$ find -name "*Servlet.java" | sed -e 's/\(.*\)\.java/<servlet>\n
<servlet-name>\1<\/servlet-name>\n
<servlet-class>\1<\/servlet-class>\n<\/servlet>\n\n<servlet-mapping>\n
<servlet-name>\1<\/servlet-name>\n
<url-pattern>\1<\/url-pattern>\n<\/servlet-mapping>/'

Obviously, you'll have top massage some of that: the servlet-class needs
to be dot-separated the the above command will give you slash-separated
names.

You'll also have to separate the <servlet> and <servlet-mapping>
sections ... or just run two separate commands: one to generate the
<servlet> elements and the other to generate the <servlet-mapping> elements.

Removing the invoker servlet and just explicitly mapping everything is
only a /little/ tedious but much safer. Take the time to do this now.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3w+CIACgkQ9CaO5/Lv0PAi+gCfYfLAaOJQIM0ziCbGOLN4eCno
4HYAoLLVVZQogmdMk1SzdXTpLEi9zbPm
=+1/1
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message