Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clarification on Servlet Spec for URL Mapping

 
Chandrakanth
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • 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.
 
srilatha kareddy
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic