• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt regarding mapping request URI

 
shwetha bol
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case of mapping request URI to servlet, its been mentioned in SCWCD exam study kit that 'Context Path and servlet paths start with /
but doesn't end with it'
consider following lines from web.xml

what is servlet path? If the request URI is /colorapp/blue/
Is it /blue/ and path info -null (assuming /colorapp is context path.)
Thank you
shwetha
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ContextPath=/colorapp
ServletPath=/blue
PathInfo=null
- Peter
 
shwetha bol
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
thanks for the reply. but i still have the doubt where did '\' after the blue go, its not there in servlet path as well as pathinfo
thanks
 
shwetha bol
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i meant '/' in my previous post
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before I answer, I see there's a formality to get out of the way -- please look at our naming policy and update your display name accordingly. Thanks.
Actually, you're absolutely right in pointing out that I ignored a few little details in your example. Given the servlet mapping to "/blue/", a request for "/colorapp/blue/" should give a ServletPath of "/blue/", since that is the mapping which invokes the servlet.
It's a bit of an unusual mapping, though; usually, you'd either map to "/blue" in which case a request for "/colorapp/blue/" will produce a 404 page not found error, or you'd map to "/blue/*" in which case the servlet should be invoked with PathInfo="/".
- Peter
 
shwetha bol
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic