Listing Request Attributes


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.


    <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)

Have you created code you'd like to share with the dotCMS community?

Share your code Become a Contributor