Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

servlet mapping  RSS feed

 
Amol Fuke
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

In head first book , page 587 ,

Question:
For this request ,
http://localhost:8080/MapTest/fooStuff/bar/foo.fo
what would be the container's choice among the following mappings ?



The answer is Three.Can somebody explains me how the answer is Three ?

Thanks,
Amol
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The pattern "/fooStuff/bar" doesn't match the URL; since it doesn't contain a wildcard it requires an exact match.

If the pattern were "/fooStuff/bar/*" then it would be matched instead of "/fooStuff/*" because it is more specific.
 
Kunal Jag
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following are different match types one can define in the Deployment Descriptor (DD) web.xml file.

Exact Match
An exact match ends with an extension, like .do or .process. This type of match has the highest priority and resolved first if one such exists.

Example:


Directory Match
A directory match ends with an asterisk (*).
Example:


Extension Match
Extension MatchStarts with an asterisk and ends with an extension. This type of match has the least priority and resolved if the other two match types are not resolved.

Example:
 
Amol Fuke
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf and Kunal !

- Amol
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!