File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes servlet path in a filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "servlet path in a filter" Watch "servlet path in a filter" New topic

servlet path in a filter

Jerret Halter
Ranch Hand

Joined: Feb 03, 2006
Posts: 62
I am having troubles retrieving the servlet path in a filter I wrote. Within the doFilter() method I cast the ServletRequest to a HttpServletRequest then call getServletRequest() on it and store what is returned into a String, but it is only returning the name of the servlet. For example.

http://localhost/contextRoot/foo/bar/servlet.jsp will only return

servlet.jsp instead of


My configurations in my web.xml are correct.

Any ideas?

Jerret Halter<br /> <br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.<hr></blockquote>
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

Perhaps if you were to explore the rest of the request API...

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: servlet path in a filter
It's not a secret anymore!