Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
Sometimes when you are performing some web programming in iDocScript it is necessary to get at the HTTP Headers of the request. The headers are there, and they are available, but they may be named something different from what you are expecting. For example, "Accept-Language" will be available as "HTTP_ACCEPT_LANGUAGE".
When I make a normal request and I spy on the request using a tool like Fiddler the headers I am sending are listed out as:
Accept: */* Accept-Encoding: gzip, deflate Accept-Language: en-us UA-CPU: x86 User-Agent: Mozilla/4.0... Connection: Keep-Alive Host: localhost Cookie: IntradocAuth=Internet; IdcLocale=English-US
Then, here are the request variables printed out by Content Server (matching from above are bolded):
HTTP_ACCEPT=*/* HTTP_ACCEPT_ENCODING=gzip, deflate HTTP_ACCEPT_LANGUAGE=en-us HTTP_USER_AGENT=Mozilla/4.0... HTTP_CONNECTION=Keep-Alive HTTP_HOST=localhost HTTP_COOKIE=IntradocAuth=Internet; IdcLocale=English-US REQUEST_METHOD=GET IdcAuthChallengeType=http IsSocketConnection=1 SERVER_NAME=localhost ThreadCount=1 SERVER_SOFTWARE=Microsoft-IIS/6.0 HTTP_CGIPATHROOT=/wcm/idcplg RemoteClientHostAddress=127.0.0.1 ssoriginalurl=/web/index.htm GATEWAY_INTERFACE=CGI/1.1 REMOTE_ADDR=x.x.x.x SERVER_PROTOCOL=HTTP/1.1 IDC_REQUEST_AGENT=webserver SERVER_PROTOCOL_TYPE=NONE QUERY_STRING=IdcService=SS_GET_PAGE&siteId=web&siteRelativeUrl=%2Findex.htm&ssUrlType=2 REMOTE_HOST=x.x.x.x REQUESTURI=/wcm/groups/system/documents/web_assets/wpl_www_jsp.jsp RemoteClientPort=4444 SERVER_PORT=80 RemoteClientRemotePort=1231 CONTENT_LENGTH=0 IDC_REQUEST_CTIME=1224069779 PATH_TRANSLATED=c:\inetpub\wwwroot
So, to use these in iDocScript I can call them by the names from this last list, with something like <$HTTP_HOST$> or <$HTTP_ACCEPT_LANGUGAE$>
Side Note, to get these variables printed out I put this code in my Site Studio page (JSP). This caused my binder to print out to my page so I could see all the information available to me.
<%=serverbean.evalIdcScp("trace(\"#all\", \"MyTest\")")%><%=serverbean.evalIdcScp("trace(\"#all\", \"MyTest\")")%> <%=serverbean.evalIdcScp("MyTest")%> <%=serverbean.evalIdcScp("MyTest")%> And finally, if you are passing in custom headers you are in for a treat because then you may need a component to serialize your custom header.
<%=serverbean.evalIdcScp("trace(\"#all\", \"MyTest\")")%> <%=serverbean.evalIdcScp("MyTest")%>
And finally, if you are passing in custom headers you are in for a treat because then you may need a component to serialize your custom header.