mod_proxy_ajp AJP_ attributes are present but not shown from request.getAttributeNames()

159 Views Asked by At

AJP_ attributes sent from apache mod_proxy_ajp to tomcat ajp connector can be retrieved with java code like

String attributeValue = request.getAttribute(attributeName);

Doing so, I have seen that these forwarded attributeNames are not listed in the enumeration we get with request.getAttributeNames(). This last method return only these 4 ones, missing the AJP_* attributes:

javax.servlet.forward.request_uri
javax.servlet.forward.context_path
javax.servlet.forward.servlet_path
javax.servlet.forward.path_info
javax.servlet.forward.mapping

For example I can retrieve a "groupID" in my java with request.getAttribute("groupID") but request.getAttributeNames() doesn't list "groupID". Why ??

ENV: Apache Tomcat/8.5.54 (Debian) Apache/2.4.25 (Debian)

Bernard

1

There are 1 best solutions below

5
Christopher Schultz On

This is by design. These attributes are "hidden" and will not appear in the return value from ServletRequest.getAttrbuteNames. You have to know the names of the attributes in order to fetch them.