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 invoker woes - servlet-mapping /servlets/* to invoker fails on 3.2
Date Sat, 18 Nov 2000 00:29:07 GMT
As of Tomcat 3.2-b8 (to be created on Monday), you will be able to set a parameter in the
server.xml file to override the prefix used by the invoker servlet.  There is an entry that
looks like this:

    <RequestInterceptor
        className="org.apache.tomcat.request.InvokerInterceptor"
        debug="0" prefix="/servlet/" />

and you can change the prefix attribute to "/servlets/" for your particular case.

In Tomcat 4.0, the ability to configure global defaults in the "conf/web.xml" file is
restored to the way it worked in Tomcat 3.1 -- it is much more intuitive for things like
this.

Craig McClanahan


Rachel Greenham wrote:

> As subject: Our website uses a large number of servlets reference through
> URLs of the form /servlets/<fully-qualified-class-name>. We got this to work
> on Tomcat 3.1 by putting in a servlet-mapping tag in the webapp's WEB-INF
> file thus:
>
>     <servlet-mapping>
>                 <!--
>                 Set up a mapping to allow any URL where the path starts "/servlets/"
to
>                 be invoked as a servlet.
>                 This saves us having to give all our servlets aliases and rewriting all
>                 the jphtml scripts to match!
>                 -->
>         <servlet-name>
>             invoker
>         </servlet-name>
>         <url-pattern>
>             /servlets/*
>         </url-pattern>
>     </servlet-mapping>
>
> However, this doesn't work in Tomcat 3.2 beta 7. Instead I have had to alter
> the RequestInterceptor line for the invoker in $TOMCAT_HOME/conf/server.xml
> thus, so I can get the site working today at least:
>
>         <RequestInterceptor
>             className="org.apache.tomcat.request.InvokerInterceptor"
>             debug="0" prefix="/servlets/" />
>
> Furthermore, I *had* to take out the servlet-mapping tag in the web.xml file
> as well or it still wouldn't work, which means I can't use the same web.xml
> across both versions, which creates administration headaches. Also, this way,
> there's no longer a request interceptor for /servlet/* which means, for
> example, the URLs to the servlets in the "examples" webapp no longer work. In
> other words, this configuration change is global to the servlet container,
> and can break other web applications running on it. Also, I don't know if
> it's guaranteed even to work on other servlet containers.
>
> My question is:
>
> What is the *right* thing to do here, for maximum compatibility? Is the use
> of actual servlet class names in URLs now supposed to be deprecated and
> not-to-be relied upon? Should we be using servlet aliases consistently now?
> In which case we do after all need to go through all our HTML files and other
> scripts changing URLs to use servlet aliases for all our servlets. Personally
> I suspect this is the right way, and the end result would be a cleaner
> webapp, but the person who tells our web designers to do the changes is not
> going to be popular!
>
> OR...
>
> Is the current Tomcat 3.2 beta 7 behaviour wrong?
>
> OR...
>
> Is there a more definitive way of doing this servlet mapping? I thought the
> servlet-mapping tag in WEB-INF/web.xml was unproblematic myself.
>
> --
> Rachel


Mime
View raw message