com.HTTPServiceRequest.setResponseHeader

Defines a header for the HTTP response.

Syntax

setResponseHeader(
   name STRING,
   value STRING )
  1. name is the name of a header to define.
  2. value is the value of a header to define.

Usage

The setResponseVersion() method sets (or replaces) the name and value of a HTTP response header.

The Content-Length header cannot be set, because it is computed internally according to the body size.

The method must be called before sending the response with one of sendResponse, sendTextResponse, sendXmlResponse, or beginXmlResponse and endXmlResponse methods.

In case of error, the method throws an exception and sets the STATUS variable with the appropriate error number.