This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes url matching doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "url matching doubt" Watch "url matching doubt" New topic
Author

url matching doubt

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Hey,

1. In directory match was is necessary to have the end slash also.

eg:



is this servlet match with the following request as directory match?
http://localhost/Test/abc (no end slash like /abc/)


2.It was said that if a request match more than one url-pattern container will choose the longest mapping also it was said container will first look for exact match , directory match and then extension map. so its kind of contradictory know? since the exactly match is the longest this wouldnt be a problem? but what if we choose both exact and directory match have the same length.
eg:
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
In this case the exact match will always win.

As for the slash, a mapping of /dir/* and a request of http://localhost:8080/PROJECT_NAME/dir will also map to the corresponding servlet.


JDBCSupport - An easy to use, light-weight JDBC framework -
Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Ive found this article also it says if that slash not there it will need a exact macth..

That would be an unmatched pattern since the * would not be a wildcard, but must be an exact match


reference:
http://www.coderanch.com/t/422371/Servlets/java/HttpServletRequest-getRequestDispatcher-behaving-strangely
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: url matching doubt
 
Similar Threads
order of filter mapping
j2eecertification.com question
Q. on Servlet Mapping Specification (re-post)
servlet mapping
HFSJ - Servlet Mapping Doubt