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.

Note : All this variables are read Only.

"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 Request
  • pageName = accessRequestHeader
  • pageGroup = HowTo

  • Loop through all HTTP Header
  • _remoteHost = 54.224.168.206
  • Host = cloudcms.sheelapps.com
  • _remoteAddr = 54.224.168.206
  • X-AppEngine-CityLatLong = 39.043757,-77.487442
  • User-Agent = CCBot/2.0 (http://commoncrawl.org/faq/)
  • _queryString =
  • X-Google-Apps-Metadata = domain=sheelapps.com
  • X-AppEngine-Region = va
  • X-AppEngine-City = ashburn
  • X-Cloud-Trace-Context = 4391ec6605b78305b0c892c2f3a25a6a/8441162575159823830;o=1
  • _pathInfo =
  • _requestURL = http://cloudcms.sheelapps.com/HowTo.accessRequestHeader
  • If-Modified-Since = Thu, 21 Sep 2017 03:06:46 GMT
  • _requestURI = /HowTo.accessRequestHeader
  • X-AppEngine-Country = US
  • _contextPath =
  • X-Zoo = app-id=cloudcmsdemo,domain=sheelapps.com
  • X-AppEngine-Default-Namespace = sheelapps.com
  • Accept = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

  • Loop through all HTTP session
  • org.vraptor.scope.ScopeType_FLASH ={}

  • 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