• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
sid smith
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37253
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sid smith
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 / ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!