I've searched for answers and also read the previous discussion at:
http://marc.theaimsgroup.com/?t=98684705800002&r=1&w=2
about servlet mapping but have some follow up questions that boil down to
the same question: "how do I exclude certain directories".
I'm using Tomcat 4.0.3 and I've got a directory structure of:
\myapp
\images
tomcat.gif
\private
hello.jsp
index.html
\WEB-INF
web.xml
\classes
Nodes.java
and my web.xml contains the following:
<servlet>
<servlet-name>NodeServlet</servlet-name>
<servlet-class>Nodes</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>NodeServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
- NodeServlet simply returns some text so I can see it running for now.
- /myapp/node/hello.jsp is correctly processed, which is as it should be
since JSP's are implicitly handled, .
- /myapp/images/tomcat.gif is not returned, instead NodeServlet intercepts
it
- /myapp/node/index.html is not returned, instead NodeServlet intercepts it
So, I've tried various things to fix it.
1) does the url-mapping of "/" really catch all requests or should it be
"/*"?
I think "/" works as advertised.
2) without declaring them explicitly, are the 'default' and 'jsp' servlets
(from Tomcat's web.xml) known to the 'myapp' web application deployment
descriptor (web.xml)? Or do I have to re-declare them in the web.xml for
each web app?
That is, I thought adding the following would solve my problems. Alas no:
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/node/*</url-pattern>
</servlet-mapping>
Either the rule is wrong or the default servlet doesn't exist.
3) when I added the rule in 2), /myapp/node/hello.jsp stopped working also,
it returns the page but doesn't execute the JSP. So I tried adding:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/node/*.jsp</url-pattern>
</servlet-mapping>
No change. Again, it seems as if the 'jsp' servlet isn't known in the webapp
(it is still declared in my Tomcat web.xml).
4) According to the spec, order of <servlet-mapping> tags doesn't matter
(most specific wins instead). Please confirm.
Needless to say, this doesn't work the way I expected it to. Everything is
served by the servlet.
5) is there a way to debug/trace the matching algorithms?
Any help is greatly appreciated,
Per
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>