tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Servlet mapping
Date Mon, 14 Aug 2000 11:49:51 GMT
"Schmitt, Christian" wrote:

> Hi all,
> I have a question concerning mapping of servlets.
> Consider the following excerpt from server.xml:
>
> <Context
>   path="/cs/maptest"
>   docBase="/home/cs/maptest"
>   debug="1"
>   reloadable="true" >
> </Context>
>
> Now I have the following on my web.xml:
> <web-app>
>   <servlet>
>     <servlet-name>info</servlet-info>
>     <servlet-class>Info</servlet-class>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>info</servlet-name>
>     <url-pattern>info/*</url-pattern>
>   </servlet-mapping>
> </web-app>
>
> Now when I point my browser to http://localhost/cs/servlet/info the servlet
> is found and executes as expected. But what I really want to do is for
> example: http://localhost/cs/some/directory/info but Tomcat does not find
> the servlet and returns a 404 error. When I change the servlet mapping in
> web.xml to:
>   <servlet-mapping>
>     <servlet-name>info</servlet-name>
>     <url-pattern>/info/*</url-pattern>
>   </servlet-mapping>
>
> Now Tomcat finds the servlet under http://localhost/cs/servlet/info as well
> as http://localhost/cs/info but not under any other paths.
>

How about the following (assuming that "/cs" is your context path):

    <servlet-mapping>
        <servlet-name>info</servlet-name>
        <url-pattern>/some/directory/info/*</url-pattern>
    </servlet-mapping>

>
> Am I missing something here or is it not possible?
>
> Thanks for any tips.
>
> Christian Schmitt

Craig



Mime
View raw message