tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Doe" <mobilephant...@hotmail.com>
Subject web.xml: my default.css file does not work correctly
Date Sat, 31 Jul 2004 11:07:32 GMT
I thought I'd grasped the way the deployment descriptor works in Tomcat. But 
I've still got problems I don't understand. In summary: my default.css file 
does not work with this web.xml file:

<web-app>
<servlet><servlet-name>Index</servlet-name>
<servlet-class>com.wingtip.Index</servlet-class></servlet>

<servlet><servlet-name>Router</servlet-name>
<servlet-class>com.wingtip.Router</servlet-class></servlet>


<!-- Access to root invokes Index. -->
<servlet-mapping><servlet-name>Index</servlet-name>
<url-pattern>/</url-pattern></servlet-mapping>

<!-- All URLs end .myext. These are processed by the front controller. -->
<servlet-mapping><servlet-name>Router</servlet-name>
<url-pattern>*.myext</url-pattern></servlet-mapping>
</web-app>

So there is a url-pattern for / -- the root URL, and there is a url-pattern 
for anything ending *myext. All this works fine. I put all the routing code 
into the Router.java file and this works like a dream. It gives me the 
benefit of putting all this logic in one file, and so I can see what is 
going on, and apply consistent security treatment to all my URLs. Great!

But the fly in the ointment is CSS (and image files too). These appear not 
to be available. How do I get round this? I have seen mention of a 'default' 
servlet in the Servlet spec, but no more details. How do you make all URLs 
that don't match your patterns 'fall through' so they can be used by 
whatever notion of webserver exists in Tomcat?

Incidentally, it would be *really* nice to have just the one servlet 
defined. Is it legal/possible to the reference to Index above removed and 
add the / to the Router servlet?

One final point. I've heard mention that it is not good form to use a / 
mapping. If not, what is the alternative?

Joe.

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
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