• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URL mappings

 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which are valid URL mappings to a servlet in a web deployment descriptor?
A */*
B /*.do
C /MyServlet
D scwcd/MyServlet
E /MyServlet/*

To my opinion C, E are correct

Mock Exam Explaination
Answer B,C,E

???Experts Opinion.
 
Nikhilesh Fonseca
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*.do this is known as the extension mapping rule as in any request with a .do extension would go to the mapped servlet.
But this rule would come into play only when the other Path mapping rules would fail.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see what you mean about the /*.do mapping - although it would be nice if this did work, the servlet spec. makes no mention of it being valid. THe relevant paragraphs of section SRV.11.2 of the spec. state:
From Servlet 2.4 spec:

  • A string beginning with a �*.� prefix is used as an extension mapping.
  • ...
  • All other strings are used for exact matches only.
  • So in fact I would assume they've made a mistake and meant to have *.do as option B. In that case it would be correct. As it is, according to the spec., B would be interpreted as the path to the resource called "*.do" under the / root... which seems a bit daft!
     
    Gaurav Gambhir
    Ranch Hand
    Posts: 256
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Charles
     
    Narendra Dhande
    Ranch Hand
    Posts: 951
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,

    From Servlet 2.4 spec:

    * A string beginning with a �*.� prefix is used as an extension mapping.
    * ...
    * All other strings are used for exact matches only.



    All the mapping string other than extension mapping must start with /, though it use for exact mapping. Please confirm

    Thanks
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic