Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the url-pattern of a servlet ?

 
qzlmk lmklq
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have defined a servlet-mapping in the web.xml of my webapp:



I want to retrieve the url-pattern of a specific servlet from another one.

For instance, from a method of my_servlet I want to obtain the url-pattern corresponding to my_servlet_bis

I try to use the ServletContext but I don't find a way to do this...

Any idea ?
[ March 22, 2006: Message edited by: qzlmk lmklq ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64190
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"qzlmk lmklq",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet can have zero, one, or many url-patterns mapped to it.
There are methods in HttpServletRequest for finding out which URL was used for each particular request but the servlet itself has no way of knowing which URL patterns have been mapped to it.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic