File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "url matching doubt" Watch "url matching doubt" New topic

url matching doubt

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 331

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


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.
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: 331
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

I agree. Here's the link:
subject: url matching doubt
It's not a secret anymore!