Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

servlet mapping

 
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
 
Rancher
Posts: 43016
76
  • 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.
 
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
 
I've been selected to go to the moon! All thanks to this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic