tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Reger, Jr." <...@joereger.com>
Subject Bahavior of url-pattern in Tomcat 5.0.2
Date Mon, 30 Jun 2003 15:18:47 GMT

Hi!  

I'm working with the servlet-mapping tag in web.xml running on Tomcat 5.0.2.
In particular, I'm working with the url-pattern schemes.  I've got a simple
"Hello World!"-style servlet that I'm trying to map various URLs to.  Below
I list some samples and my results.

Why does Test 3 fail?  Shouldn't I be able to define a mapping like
*-foo.joetest?  It's very similar to Test 2.

Why does Test 2 work (*.joetest) but Test 5 fail (*.joetest.foo)?

It seems that I can't really use the wildcard character in a traditional
sense.  There are some other rules. If these are desired behaviors, is there
a reference for url-pattern tag rules? 

Thanks,

Joe


Test 1 -------------------------------
(Basic example.)
<servlet-mapping>
    <servlet-name>joetest</servlet-name>
    <url-pattern>/joetest</url-pattern>
</servlet-mapping>
This works for URL: http://localhost/myapp/joetest

Test 2 -------------------------------
(Basic wild card mapping to servlet.)
<servlet-mapping>
    <servlet-name>joetest</servlet-name>
    <url-pattern>*.joetest</url-pattern>
</servlet-mapping>
This works for URL: http://localhost/myapp/89j98jh8hjl.joetest
This works for URL: http://localhost/myapp/anything.joetest
This works for URL: http://localhost/myapp/.joetest

Test 3 -------------------------------
(Adding something other than the . to the right of the wildcard.)
<servlet-mapping>
    <servlet-name>joetest</servlet-name>
    <url-pattern>*-foo.joetest</url-pattern>
</servlet-mapping>
Does NOT work for: http://localhost/myapp/687-foo.joetest
Does NOT work for: http://localhost/myapp/*-foo.joetest
Does NOT work for: http://localhost/myapp/-foo.joetest

Test 4 -------------------------------
(Trying to add the absolute path reference.)
<servlet-mapping>
    <servlet-name>joetest</servlet-name>
    <url-pattern>/*-foo.joetest</url-pattern>
</servlet-mapping>
This works for URL: http://localhost/myapp/*-foo.joetest
(Note that the * above is the actual * character typed into the browser.)

Test 5 -------------------------------
(Similar to Test 2 but with a twist.)
<servlet-mapping>
    <servlet-name>joetest</servlet-name>
    <url-pattern>*.joetest.foo</url-pattern>
</servlet-mapping>
Does NOT work for: http://localhost/myapp/6872434ef.joetest.foo
Does NOT work for: http://localhost/myapp/*.joetest.foo




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message