Some Helpful Java Servlet Attributes That Are Presumably Documented Somewhere

I'm assuming these are documented somewhere, but they certainly weren't listed in the documentation I have.

Anyhoo:

javax.servlet.forward.request_uri - the original value returned from request.getRequestURI()
javax.servlet.forward.context_path - the original value returned from request.getContextPath()
javax.servlet.forward.servlet_path - the original value returned from request.getServletPath() (who'd have guessed?)

These answer the question I've spent far too long trying to figure out, "how do you figure out the original request URI before the request was forwarded?"

Apparently these were added as of Java Servlets 2.4.

Topics: