I am using a subclass of HttpServletRequestWrapper
to do some translations on the request parameters, and I cache the translated values the first time they are
The original request URI is available as request attribute with the key RequestDispatcher.FORWARD_REQUEST_URI.
String originalRequestURI = request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
if (originalRequestURI != null) {
// It was forwarded. Now get the query string as follows.
String originalQueryString = request.getAttribute(RequestDispatcher.FORWARD_QUERY_STRING);
}
Note: in older Servlet API versions you need to hardcode the key instead.
String originalRequestURI = request.getAttribute("javax.servlet.forward.request_uri");
// ...