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:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to