How to access HTML Request data
Each Freemarker cloudCMS page has access to pre-defined set of variables. Following are implicit variables available to each page.
- wbrequest - This denotes the data included with the HTTP Request.
- wbheader - This denotes the data associated with a HTTP Header.
- wbsession - This denotes the data associated with a specific session of user.
"wbrequest" Attributes
wbrequest have two custom attributes "pageName" and "pageGroup" which denotes current requested page. You can access other request parameters using following syntax :
wbrequest.<varname>or
wbrequest["var name"]For multi-value parameter (like "?id=1&id=2") cloudCMS will set Freemarker sequence with all the values. In "wbheader" all the parameters prefix with "_" are custom variables added by cloudCMS.
Try following example links to see how the request information changes below :
HowTo.accessRequestHeader?myparam=somevalue¶m2=somevalue2
HowTo.accessRequestHeader?xyz=1&xyz=2
Following is the dump of current HTTP Request/Header/Session data :
Loop through all HTTP RequestLoop through all HTTP Header
Loop through all HTTP session
Source code of above example
<h4>Current Request Information : </h4>
<strong>Loop through all HTTP Request </strong><br/>
<#assign keys = wbrequest?keys>
<#list keys as key><li>${key} =
<#if (wbrequest[key])?is_sequence>
<#list wbrequest[key] as val> ${val}, </#list>
<#else>
${wbrequest[key]}
</#if>
</li>
</#list>
<br/>
<strong>Loop through all HTTP Header </strong><br/>
<#assign keys = wbheader?keys>
<#list keys as key><li>${key} = ${wbheader[key]} </li> </#list>
<br/>
<strong>Loop through all HTTP session </strong><br/>
<#assign keys = wbsession?keys>
<#list keys as key><li>${key} =${wbsession[key]}</li> </#list>
blog comments powered by Disqus
Last Modified : Jul 10, 2009 3:18:55 PM