You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Kenneth R. Kress" <kk...@home.com> on 2000/09/01 08:02:48 UTC
web.xml, Apache and url-pattern
I've been searching the archives all night for an answer to this. I know this
issue has been answered before, but I just can't find it.
I'm trying to use the url-pattern in my context/WEB-INF/web.xml file to
work. I can change the URL I use *only* when using port 8080 to
talk directly to tomcat. If I talk to Apache, the web.xml directives
seem to have no effect.
Here's a snippet from web.xml:
<web-app>
<servlet>
<servlet-name>
AdminSrvlt
</servlet-name>
<servlet-class>
AdminSrvlt
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
AdminSrvlt
</servlet-name>
<url-pattern>
/cgi_bin
</url-pattern>
</servlet-mapping>
</web-app>
This is in my $TOMCAT_HOME/conf/server.xml file:
<Context path="/intranet"
docBase="webapps/intranet"
debug="0"
reloadable="true">
</Context>
My tomcat-apache.conf is auto-generated and that's what's included
in my Apache httpd.conf file.
The following works:
http://localhost:8080/intranet/cgi_bin
but this fails:
http://localhost/intranet/cgi_bin
This also works (as you would expect): http://localhost/intranet/servlet/AdminSrvlt
What am I missing?
Ken.
--
Kenneth R. Kress kkress@home.com
kkress@ospreypartners.com
Re: web.xml, Apache and url-pattern
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
I don't know if it will solve all your problems, but you might try a <url-pattern> of
"/cgi_bin/*" instead of "/cgi_bin". The one you are using will only match if the user
specifies it exactly, while the one I suggested will match any context-relative path
that begins with "/cgi-bin". This is important when you realize that Tomcat issues a
redirect from
http://localhost/intranet/cgi_bin
to
http://localhost/intranet/cgi_bin/
which does *not* match the url pattern you are using.
Craig McClanahan
"Kenneth R. Kress" wrote:
> I've been searching the archives all night for an answer to this. I know this
> issue has been answered before, but I just can't find it.
>
> I'm trying to use the url-pattern in my context/WEB-INF/web.xml file to
> work. I can change the URL I use *only* when using port 8080 to
> talk directly to tomcat. If I talk to Apache, the web.xml directives
> seem to have no effect.
>
> Here's a snippet from web.xml:
> <web-app>
> <servlet>
> <servlet-name>
> AdminSrvlt
> </servlet-name>
> <servlet-class>
> AdminSrvlt
> </servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>
> AdminSrvlt
> </servlet-name>
> <url-pattern>
> /cgi_bin
> </url-pattern>
> </servlet-mapping>
> </web-app>
>
> This is in my $TOMCAT_HOME/conf/server.xml file:
>
> <Context path="/intranet"
> docBase="webapps/intranet"
> debug="0"
> reloadable="true">
> </Context>
>
> My tomcat-apache.conf is auto-generated and that's what's included
> in my Apache httpd.conf file.
>
> The following works:
>
> http://localhost:8080/intranet/cgi_bin
>
> but this fails:
>
> http://localhost/intranet/cgi_bin
>
> This also works (as you would expect): http://localhost/intranet/servlet/AdminSrvlt
>
> What am I missing?
>
> Ken.
>
> --
> Kenneth R. Kress kkress@home.com
> kkress@ospreypartners.com
--
====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00): Sun Technical Briefing
Session T06 (24-Oct 14h00-15h00): Migrating Apache JServ
Applications to Tomcat