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>
      #set($reqAttrList = $request.getAttributeNames())
      #foreach($reqAttr in $reqAttrList)
      <br/>Attr = $reqAttr Value = $request.getAttribute($reqAttr)

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

Share your code Become a Contributor