Hi! I've just joined this list. I looked briefly the mailing list archive, but couldn't find a solution to my url-pattern problem. Hope I'm not sending faq. My webapp is "crisscross". I want to map /crisscross/*.xml and /crisscross/*.html to xmlServlet. For example /crisscross/sub/*.xml shouldn't be mapped to xmlServlet because the request isn't a "base-dir"-request. Could someone figure out, how to do this? I'm using Tomcat 4.1.12, and here are my false attempts:
First attempt (Patterns with slash): <servlet-mapping> <servlet-name>xmlServlet</servlet-name> <url-pattern>/*.xml</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>xmlServlet</servlet-name> <url-pattern>/*.html</url-pattern> </servlet-mapping> http://localhost:8080/crisscross/test.xml Mapped to servlet 'default' with servlet path '/test.xml' and path info 'null' and update=true http://localhost:8080/crisscross/test.html Mapped to servlet 'default' with servlet path '/test.html' and path info 'null' and update=true http://localhost:8080/crisscross/*.html Mapped to servlet 'xmlServlet' with servlet path '/*.html' and path info 'null' and update=true http://localhost:8080/crisscross/*.xml Mapped to servlet 'xmlServlet' with servlet path '/*.xml' and path info 'null' and update=true Why two first URLs aren't mapped to xmlServlet? Second attempt (Patterns without slash): <servlet-mapping> <servlet-name>xmlServlet</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping <servlet-mapping> <servlet-name>xmlServlet</servlet-name> <url-pattern>*.xml</url-pattern> </servlet-mapping http://localhost:8080/crisscross/test.xml Mapped to servlet 'xmlServlet' with servlet path '/test.xml' and path info 'null' and update=true http://localhost:8080/crisscross/test.html Mapped to servlet 'xmlServlet' with servlet path '/test.html' and path info 'null' and update=true http://localhost:8080/crisscross/sub/test.xml Mapped to servlet 'xmlServlet' with servlet path '/sub/test.xml' and path info 'null' and update=true Handles (naturally) too much (sub-dir xml's too). Third attempt: Trying to map every "...:8080/crisscross/*.*ml" to xmlServlet (every markup request, except sub-dir ones) <servlet-mapping> <servlet-name>xmlServlet</servlet-name> <url-pattern>/*.*ml</url-pattern> </servlet-mapping> http://localhost:8080/crisscross/test.xml Mapped to servlet 'default' with servlet path '/test.xml' and path info 'null' and update=true http://localhost:8080/crisscross/sub/test.xml Mapped to servlet 'default' with servlet path '/sub/test.xml' and path info 'null' and update=true http://localhost:8080/crisscross/test.*ml Mapped to servlet 'default' with servlet path '/test.*ml' and path info 'null' and update=true http://localhost:8080/crisscross/sub/test.*ml Mapped to servlet 'default' with servlet path '/sub/test.*ml' and path info 'null' and update=true Nothing gets mapped to xmlServlet. Fourth attempt: Trying to map every *.*ml to my servlet <servlet-mapping> <servlet-name>xmlServlet</servlet-name> <url-pattern>*.*ml</url-pattern> </servlet-mapping> http://localhost:8080/crisscross/test.jml Mapped to servlet 'default' with servlet path '/test.jml' and path info 'null' and update=true http://localhost:8080/crisscross/test.*ml Mapped to servlet 'xmlServlet' with servlet path '/test.*ml' and path info 'null' and update=true None of markup-requests maps to xmlServlet BTW: my web.xml contains only one servlet-entry: <servlet> <servlet-name>xmlServlet</servlet-name> <servlet-class>fi.tut.pori.amc.games.crisscross.GameServlet</servlet-class> </servlet> After this entry I've tried those mappings/patterns. There aren't any other entries in web.xml Cheers Kai Ojansuu ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html