Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet path in a filter

 
Jerret Halter
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

/foo/bar/servlet.jsp

My configurations in my web.xml are correct.

Any ideas?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps if you were to explore the rest of the request API...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic