• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Giving same name for URL pattern in web.xml

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rancher
Can we give the same name to URL pattern that already has been given?
If yes which resouce is sent back to client?Please Help
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why would you want to do such a thing?
 
swarupa patil
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interviewer asked me this question and excepting detail answer
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try it?
What happened?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is that how he worded the question?
Was he asking if you can use the same url pattern for two different mappings?

Or.....

Was he asking if you can map to different url patterns to the same servlet name?
 
swarupa patil
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried this in Tomcat5.028 server I get result
Server doesnot throw any excetion.
But result is unexpected. I hope i got first resource
which has already used this name. But it displays different
Can u answer this how it works?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read my last question.
We may have had our last two posts cross.

Without knowing exactly what the interviewer asked you, it would be hard to give you an answer.
 
swarupa patil
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you use the same url pattern for two different (resources)mappings?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personally, I can't see the sense in asking such a question.
Maybe you misunderstood him.

Section 10 of the servlet spec (link in my signature) covers url patterns.

It would make sense for him to ask you about multiple mappings pointing to the same resources. It would also make sense if he asked about the a given request matching two different mappings.
Example
if the request was:
http://www.javaranch.com/myServlets
and you had two mappings that matched this pattern


In this case, section 10 of the servlet spec clearly states which of the two mappings should be used.
Now that I think of it, this must have been what he was asking.
There is no logical reason for the servlet spec to give directions for handling two mappings with identical url-patterns.
[ June 01, 2006: Message edited by: Ben Souther ]
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic