Listing Request Attributes

Description

The following code can be used on your site to list all the attributes and values stored in the Request object. It's wrapped with a condition to only display when debug=true has been set in the URL as a parameter.

Code

${esc.hash}if(${esc.dollar}request.getParameter("debug"))
    <h3>HTTP Request Attributes</h3>
      ${esc.hash}set(${esc.dollar}reqAttrList = ${esc.dollar}request.getAttributeNames())
            
      ${esc.hash}foreach(${esc.dollar}reqAttr in ${esc.dollar}reqAttrList)
      <br/>Attr = ${esc.dollar}reqAttr Value = ${esc.dollar}request.getAttribute(${esc.dollar}reqAttr)
      ${esc.hash}end
      ${esc.hash}end