A SERVICE OF

logo

MediaScript Objects and Methods 41
Parameters
name - the string name indicating the HTTP header
value - the string value of the HTTP header.
getHeader()
Returns the value for the given HTTP header name.
Syntax
req.getHeader(
<name>
);
Parameters
The only parameter is the specified header name.
Example
function main() {
var respText = new TextResponse(TextResponse.TypePlain);
var headers = req.getHeaderNames();
for (var i = 0; i < headers.length; ++i)
{
respText.append(headers[i] + ": " +
req.getHeader(headers[i]) + "\n");
}
resp.setObject(respText, RespType.Streamed);
}
Sample output
accept: */*
accept-encoding: gzip, deflate
accept-language: en-us
connection: Keep-Alive
host: localhost
user-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
Q312461)
setStatusCode()
Sets the HTTP response status code. The default is STATUS_OK (200).
Syntax
resp.setStatusCode("statusCode");
Parameters
statusCode - an integer value for the HTTP response status. The default is STATUS_OK
(200).