tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raghupathy,Gurumoorthy" <gurumoorthy.raghupa...@uk.fid-intl.com>
Subject RE: url-pattern in web.xml -- looking for explanations and best p ractice
Date Wed, 11 May 2005 14:29:34 GMT
In your webapp have dir 
	
	http://servername:port/context/static/ for all your static content

	http://servername:port/context/dynamic/ for all your dynamic content


	URL Pattern
			<URL-pattern>/dynamic/*</URL-pattern>


guru
-----Original Message-----
From: Tim Diggins [mailto:subscribed@red56.co.uk] 
Sent: 11 May 2005 15:26
To: tomcat-user@jakarta.apache.org
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

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


Mime
View raw message