Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clarification on Servlet Spec for URL Mapping

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can anybody explain me a bit on what they mean....
This is part of the chapter in servlet spec("Mapping Requests to Servlets")

2. The container will recursively try to match the longest path-prefix. This is done by stepping down the path tree a directory at a time, using the �/� character as a path separator. The longest match determines the servlet selected.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<servlet-mapping>
<servlet-name>servlet1</servlet-name>
<url-pattern>/first/second/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>servlet2</servlet-name>
<url-pattern>/second/*</url-pattern>
</servlet-mapping>



if ur url is x/first/second/com.MyServlet
1. search for x/first/second/com.MyServlet pattern...NOT FOUND
2. search for /first/second/com.MyServlet pattern... FOUND

this maps to servlet1

if ur url is x/y/second/com.MyServlet
1. search for x/y/second/com.MyServlet ...pattern...NOT FOUND
2. search for /y/second/com.MyServlet ...pattern... NOTFOUND
3. search for /second/com.MyServlet ...pattern... FOUND

this maps to servlet2
 
Pay attention! Tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic