Back

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

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