com.HttpServiceRequest.setResponseHeader

Defines a header for the HTTP response.

Syntax

setResponseHeader(
   name STRING,
   value STRING )
  1. name specifies the name of a header.
  2. value defines the value of a header.

Usage

The setResponseHeader() method sets (or replaces) the name and value of an 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. Depending on the error, a human-readable description of the problem is available in the sqlca.sqlerrm register. See Error handling in GWS calls (status).