Forums Register Login

Quiz - Match the request URL to the correct URL pattern in web.xml

+Pie Number of slices to send: Send
Hi ! I am trying to learn how to map a request URL to a url pattern in deployment descriptor. I got all the answers right, but I am not sure if the thought process is correct.
Please help me to confirm or make changes in the reasoning.




1) http://localhost:8080/MapTest/blue.do
Container choice: DeployTestOne (matched the *.do extension pattern)

Exact match check: Is there a URL pattern in DD which is exactly = /MapTest/blue.do ? NO.
Directory match check: Is there any URL pattern in DD for directory /MapTest ? NO.
Extension match: Is there a pattern in DD for files with extension .do ? Yes !
Select DeployTestOne !

Question - When doing an Exact match check, does the container look for blue.do in DD or does it look for /MapTest/blue.do ?

2) http://localhost:8080/MapTest/fooStuff/bar/blue.do
Container choice: DeployTestThree (matched the /fooStuff/* directory pattern)

Exact match check: Is there a URL pattern in DD which is exactly = /MapTest/fooStuff/bar/blue.do ? NO.
Directory match check: Is there any URL pattern in DD for directory /MapTest/fooStuff/bar ? Yes !
Go for the url pattern for longest pat, that is, /fooStuff/*

Question - When doing the directory match check, does the Container look for /MapTest/fooStuff/bar/ or just /fooStuff/bar ?

+Pie Number of slices to send: Send
Sid,
Welcome to CodeRanch!

Your thought process is correct for the first two. It is that it is a "starts with" search which is /fooStuff/bar. However, the context root is not included. However context roots do not get checked. I'm presuming MapTest is your context root for the web application.
+Pie Number of slices to send: Send
 

Jeanne Boyarsky wrote:Sid,
Welcome to CodeRanch!

Your thought process is correct for the first two. It is that it is a "starts with" search which is /fooStuff/bar. However, the context root is not included. However context roots do not get checked. I'm presuming MapTest is your context root for the web application.



Thanks for the answer Jean. I was not sure what is being checked in the directory match-check in the first question. Is it just slash / ?
These are the worst of times and these are the best of times. And this is the best tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1215 times.
Similar Threads
HF S&J Error page:587-588
HFSJ - Servlet Mapping Doubt
Doubt on page 587 HFSJ
another HFSJ question page 620
Doubts on web.xml entries
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:23:30.