• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in Servlet Mapping definition given in HFSJ

 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HFSJ book its told that if a url is encountered then container checks for an exact match,then the longest directory match to shortest and then extension.But in exercises they have marked two urls
/foo/bar and /foo/* so naturally a url like ..../foo/bar/.... should go to the servlet mapped to /foo/bar right?But they have given the answer as /foo/*.Can anyone please explain?
 
Rahul Jadaun
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/foo/bar is an exact match, and it can be only that. It cannot act as a directory match. For ..../foo/bar/.... to match, the url-pattern has to be a directory match like /foo/bar/* or /foo/*(a directory match is one that always starts with / and ends in /*)
 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
say the mapping is like what you have mentioned?in that case which will be called
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!