HttpServletRequest Path Decoding
Last updated
Was this helpful?
Last updated
Was this helpful?
The documentation on HttpServletRequest is very poor, and this fills in a critical set of facts that you need to know to write a TomCat application.
The HttpServletRequest object will return the path to the current request with the following methods:
getContextPath
()
getPathInfo
()
getPathTranslated
()
getQueryString
()
getRequestURI
()
getRequestURL
()
getServletPath
()
Imagine you have a tomcat server installed at
Imagine you install an application in this server at “myapp”
That application has a servlet mounted at “servlet1”
The user then makes a request:
Here is the map of how the various functions decode this: