I am using JDK 8 and GlassFish 4, and
request.getAttribute("javax.servlet.forward.request_uri")
always returned null for me. Ultimately the work was
request.getAttribute("javax.servlet.error.request_uri")
I'm not sure why the attribute name is different, but if the name I provided does not work in your setup, here is the code I used to find it ...
Enumeration<String> names = request.getAttributeNames(); while(names.hasMoreElements()){ String name = names.nextElement(); Object attr = request.getAttribute(name); System.out.println("Req: "+name + " : "+attr); }
user3479450
source share