You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Gary Karasiuk <gk...@home.com> on 2000/06/13 15:49:00 UTC

Bug: web.xml - url-pattern

I think there is a bug in the way that URLÂ’s are mapped to servlets.

I have the following fragment in my web.xml file

  <servlet>
    <servlet-name>CheckCP</servlet-name>
    <servlet-class>karasiuk.web.CheckClassPath</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>CheckCP</servlet-name>
    <url-pattern>/CheckCPXX</url-pattern>
  </servlet-mapping>


The url http://localhost/grk/servlet/CheckCP  -- works!
But the url http://localhost/grk/servlet/CheckCPXX
<http://localhost/grk/servlet/CheckCP>   - does not work

I expected the first url not to work and the second one to work.  Do I have
this wrong?

Re: Bug: web.xml - url-pattern

Posted by Fergus Gallagher <Fe...@OrbisUK.com>.
What the url-pattern does is to alias the servlet wrt the context - try

         http://localhost/qrk/CheckCPXX

That should work.

You could try

>   <servlet-mapping>
>     <servlet-name>CheckCP</servlet-name>
>     <url-pattern>/index.html</url-pattern>
>   </servlet-mapping>

then

         http://localhost/qrk/

would work too (if the web-server is set up to return index.html pages)

The "servlet-name" has no meaning to the outside world - it is used as a 
key for other options to reference.

Fergus

At 09:49 13/06/00 -0400, you wrote:
>I think there is a bug in the way that URLs are mapped to servlets.
>
>I have the following fragment in my web.xml file
>
>   <servlet>
>     <servlet-name>CheckCP</servlet-name>
>     <servlet-class>karasiuk.web.CheckClassPath</servlet-class>
>   </servlet>
>
>   <servlet-mapping>
>     <servlet-name>CheckCP</servlet-name>
>     <url-pattern>/CheckCPXX</url-pattern>
>   </servlet-mapping>
>
>
>The url http://localhost/grk/servlet/CheckCP  -- works!
>But the url http://localhost/grk/servlet/CheckCPXX
><http://localhost/grk/servlet/CheckCP>   - does not work
>
>I expected the first url not to work and the second one to work.  Do I have
>this wrong?

--
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717