wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Dbt in Directory Matching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Dbt in Directory Matching" Watch "Dbt in Directory Matching" New topic
Author

Dbt in Directory Matching

Radmika Arunachalam
Ranch Hand

Joined: Mar 29, 2004
Posts: 45
Hi,
if you have servlet-mapping as below



if i call like this
http://localhost:80/MapTest/serve

will it call "myServlet"?
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

I think it is correct. It should invoke myServlet. Your mapping is type of path mapping. As the Path mapping is defined in web application, it will not search for welcome pages. It will always invoke the servlet.

Thanks


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
S.L.Narayanan
Ranch Hand

Joined: Apr 01, 2005
Posts: 431
Hi

I think it wont invoke the servlet that u specified in DD. Reason is u have put http://localhost:80/MapTest/serve and not http://localhost:80/MapTest/serve/. You configured the DD to map to the URLs that are accessing anything inside the directory only. So in this case container will search for an exact match. If it is not there it will throw a 404.


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, NEXT--->IBM XML
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi Naryanan

Your quote
You configured the DD to map to the URLs that are accessing anything inside the directory only. So in this case container will search for an exact match.


When the container will search for exact match ? when the URL mapping is defined for exact match. Here in DD the mapping is defined for path mapping, and not for exact match. So it alway invoke myServlet.

If you are reffering Servlet Specs.(2.4), there are very good examples on page 87 how the incoming URLs are mapped to Servlets.

Hope it help you.

Thanks
Radmika Arunachalam
Ranch Hand

Joined: Mar 29, 2004
Posts: 45
Thanks friends! Even i was thinking it will invoke only if '/' is there in the end.. now i am clear.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dbt in Directory Matching