You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2000/08/25 05:32:32 UTC

Re: Question

ALEXANDROS KOTSIRAS wrote:

> The following url-pattern is from the SnoopServlet example and
> works<url-pattern>
>             /snoop
> </url-pattern> I would like to use a pattern like the following
> : <servlet-mapping>
> <servlet-name>
>      MainAdminController</servlet-name>
> <url-pattern>
>      /admin/*
> </url-pattern></servlet-mapping> But i can't make it work.The idea is
> to tell tomcat to send all the requests that include
> /servlet/admin/whateverServlet to my MainAdminController servlet which
> will centralize authentication and some other tasks. I also added the
> following  mapping to the SnoopServet to see whether it works
> : <url-pattern>
>             /admin/snoop
> </url-pattern> but when i invoke it as
> http://hostname/contextName/servlet/admin/snoop it does not work. So
> is it possible to define mappings in that form :
> /name_1/name_2/.../name_n/* Thanks,Alex.

Leave off the "/servlet" part and things will work a lot better.  With
your servlet mapped to "/admin/*", the correct URL would be:

    http://hostname/contextName/admin/snoop

and your admin servlet woud receive a servlet path of "/admin" and a
path info of "/snoop".  You can then use the path info part to look up
the other servlet you want to run -- perhaps via the use of
ServletContext.getNamedDispatcher("snoop") in this case.

The only reason "/servlet/*" paths work is that there is a servlet (the
"invoker" servlet) included with Tomcat that is mapped to this path.  If
you really, really, want
"http://hostname/contextName/servlet/admin/snoop" to work instead,
change your URL mapping to "/servlet/admin/*" instead of "/admin/*".

Craig McClanahan



Follow up to RE: Question

Posted by Graeme Wallace <gr...@xxi.com>.
I've got Tomcat 3.1 configured up so that

the webapp jcvs contains one servlet called cvs
and the mapping /cvs/* all works so
that http://localhost:8080/jcvs/cvs/list works for example.

The question is how do you get apache to forward it.

I've included the tomcat-apache.conf file with the obiligatory stuff in it,
but I obviously need to add or change something so that the
mapping recognizes /jcvs/cvs/* as a servlet.

Any ideas ?


regards


Graeme