Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

easy uri context path req.getRequestURI()

 
Jack Adams
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there easy function to get URI with Context Path NOT included?

I am using RequestDispatcher to forward to resource.
getRequestURI() includes Context Path.
RequestDispatcher getRequestDispatcher resource is relative to Context Path.
So /contextPath/contextPath fails...
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked getContextPath() ?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Servlets forum...
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use '/' then the path (relative to the context) of the resource to which you want to forward.
Why would you need to read the path from somewhere if the resource is inside your own webapp?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic