URL patterns are quite limited for the web.xml. The document you want is 
actually the Servlet Specification PDF from Sun's J2EE website.

You can achieve what you are talking about using the JK module with Apache or 
IIS as this forwards requests from the web server to Tomcat. It allows the ! to 
say "not" this URL pattern.

Cheers, Allistair.

> -----Original Message-----
> From: Tim Diggins [mailto:[EMAIL PROTECTED]
> Sent: 11 May 2005 15:26
> To: [email protected]
> Subject: url-pattern in web.xml -- looking for explanations and best
> practice
> 
> 
> Hi-
> 
> I'm trying to configure my tomcat 5.0.28 webapp so that one 
> servlet (a 
> Spring dispatcher as it happens, but that's irrelevant) receives 
> virtually everything except standard static non-text file patterns 
> (*.css, *.png, *.gif, etc.) which I want served up statically.
> 
> I've been trying various options for url-pattern within 
> servlet mapping 
> and have been getting very confused... Some questions therefore...
> 
> 1) Is there a definition / documentation of what the syntax for a 
> url-pattern is?  I've tried and tried googling and looking, but can't 
> find such a thing (I'm not sure that it's standardised across 
> different 
> containers, but there seems to be no definition in the tomcat 
> docs that 
> I could find). Obviously, if anyone can refer me to this, 
> then I don't 
> need the other questions answered!
> 
> 
> 2) is there any way to say - if a url includes a ~ (tilde character) 
> then route it to a particular servlet. The following give errors:
>    <url-pattern>*~*</url-pattern>
>    <url-pattern>~/</url-pattern>
>    <url-pattern>~*</url-pattern>
> 
> But oddly the following doesn't:
>    <url-pattern>*.~</url-pattern>
> 
> *error looks like:
> 11-May-2005 15:13:07 org.apache.catalina.startup.ContextConfig 
> applicationConfig
> SEVERE: Parse error in application web.xml 
> java.lang.IllegalArgumentException: Invalid <url-pattern> ~/*.* in 
> servlet mapping
>          at 
> org.apache.commons.digester.Digester.createSAXException(Digester.java
> :2540)
>          at 
> org.apache.commons.digester.Digester.createSAXException(Digester.java
> :2566)
> ----------------------
> 
> 3) is there any way to specify NO extension (like a request for 
> directory) and exclude things with an extension?
> 
> 4) is there any way to specify what you want to go to the default 
> (static) servlet and then state a sink for anything else (invert the 
> default-specific servlet mapping in other words).
> 
> 5) is there some obvious best practice I'm missing here (excluding 
> making my urls less interpretable).
> 
> Many thanks
> 
> Tim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com";>www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to