• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mark, take a look on this on "Servlet Path" question

 
Jimmy Chiu
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
I am having some difficulties to understand the Servlet Spec on "Servlet Path"
In its first step (if found, not further step will be taken):
The container will try to find an exact match of the path of the request to the
path of the servlet. A successful match selects the servlet.
Why "/red/*" path mapping can match
"/My-app/red", "/My-app/red/", "/My-app/red/some" and "/My-app/red/any.xx"?
What is the "*" real meaning, is it a wild character, or a Regular Expression sign?
What "Path Info" (from SCWCD Study Kit) really is, a servlet file name?
-Thanks,
 
Mark Howard
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jimmy
I'd recommend reading section 5.2.4 of the exam study kit. I don't think I could explain it any better than that. Read it over a few times until it clicks
I also found servlet mapping a bit confusing at first, but there's nothing really tricky about it. A mapping of /aaa/* simply means that the container will search the request string recursively for a /aaa directory to find a match to a servlet. The * in *.xxx is a wild character, and is compared to the last node of the request URI to determine a match.
Mark.
 
Mark Howard
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jimmy
Another good idea is to experiment with your own servlet mappings. You can use the getContextPath(), getServletPath() and getPathInfo() methods of HttpServletRequest to see what constitutes your request string.
Good luck
 
Jimmy Chiu
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark!!!
Will do what you said.
-Jimmy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic