You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Diego Castillo <di...@inexbee.com> on 2001/04/23 15:42:25 UTC

Problem mapping servlets to /servlets/*

Hi,

I am quite new to Tomcat and I have encountered problems in mapping servlets
to specific URLs. Basically, I want my servlets to be activated when invoked
through an URL that contains /servlets/* in addition to default /servlet/*.

I have added the following to my %TOMCAT_HOME%\conf\web.xml:

<web-app>
    [...]
    <servlet-mapping>
        <servlet-name>
            invoker
        </servlet-name>
        <url-pattern>
            /servlets/*
        </url-pattern>
    </servlet-mapping>
    [...]
</web-app>

This does not work. If I point to http://localhost/servlets/IsItWorking
instead of http://localhost/servlet/IsItWorking, Apache is not able to find
the appropriate page.

Any suggestions?

Regards,


Diego Castillo


Re: Problem mapping servlets to /servlets/*

Posted by Milt Epstein <me...@uiuc.edu>.
On Mon, 23 Apr 2001, Diego Castillo wrote:

> Hi,
>
> I am quite new to Tomcat and I have encountered problems in mapping
> servlets to specific URLs. Basically, I want my servlets to be
> activated when invoked through an URL that contains /servlets/* in
> addition to default /servlet/*.
>
> I have added the following to my %TOMCAT_HOME%\conf\web.xml:
>
> <web-app>
>     [...]
>     <servlet-mapping>
>         <servlet-name>
>             invoker
>         </servlet-name>
>         <url-pattern>
>             /servlets/*
>         </url-pattern>
>     </servlet-mapping>
>     [...]
> </web-app>
>
> This does not work. If I point to
> http://localhost/servlets/IsItWorking instead of
> http://localhost/servlet/IsItWorking, Apache is not able to find the
> appropriate page.

I suspect the key point there is that *Apache* is not able to find the
appropriate page, i.e. it's not even getting to Tomcat.  The web.xml
files are only read by Tomcat.  My guess is you need to insert some
appropriate directives in the tomcat/apache conf file so that Apache
knows to pass these URLs to Tomcat in the first place.  What exactly
those are depends on which module you're using to connect Tomcat to
Apache (mod_jserv, mod_jk, mod_webapp).  Check the tomcat/apache conf
file you have now for samples.

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
mepstein@uiuc.edu


RE: Problem mapping servlets to /servlets/*

Posted by CPC Livelink Admin <cp...@fitzpatrick.cc>.
>>From the 3.2.1 server.xml
        <!-- Non-standard invoker, for backward compat. ( /servlet/* )
             You can modify the prefix that is matched by adjusting the
             "prefix" parameter below.  Be sure your modified pattern
             starts and ends with a slash.

             NOTE:  This prefix applies to *all* web applications that
             are running in this instance of Tomcat.
          -->
        <RequestInterceptor
            className="org.apache.tomcat.request.InvokerInterceptor"
            debug="0" prefix="/servlet/" />

So to add /servlets, you would need something like this in your server.xml :
        <RequestInterceptor
            className="org.apache.tomcat.request.InvokerInterceptor"
            debug="0" prefix="/servlets/" />


-----Original Message-----
From: Diego Castillo [mailto:diego.castillo@inexbee.com]
Sent: Monday, April 23, 2001 9:42 AM
To: tomcat-user@jakarta.apache.org
Subject: Problem mapping servlets to /servlets/*


Hi,

I am quite new to Tomcat and I have encountered problems in mapping servlets
to specific URLs. Basically, I want my servlets to be activated when invoked
through an URL that contains /servlets/* in addition to default /servlet/*.

I have added the following to my %TOMCAT_HOME%\conf\web.xml:

<web-app>
    [...]
    <servlet-mapping>
        <servlet-name>
            invoker
        </servlet-name>
        <url-pattern>
            /servlets/*
        </url-pattern>
    </servlet-mapping>
    [...]
</web-app>

This does not work. If I point to http://localhost/servlets/IsItWorking
instead of http://localhost/servlet/IsItWorking, Apache is not able to find
the appropriate page.

Any suggestions?

Regards,


Diego Castillo