Publishing Engine Programmer's Guide > The Arbortext Publishing Engine Sub-Process > Writing Arbortext PE Applications in VBScript > Constructing a Response
  
Constructing a Response
The VBScript Arbortext PE Application can call the following VBScript subroutines to build the HTTP response that will be returned to the client.
VBScript Functions for Building a Response
Function
Purpose
PEAppResponse::addDateHeader( name, date )
Adds a response header with the given name. The value must be the number of milliseconds since 0:00, January 1, 1970 or a time/date string that the Java layer can convert.
PEAppResponse::addHeader( name, value )
Adds a response header with the given name and value.
PEAppResponse::addIntHeader( name, value )
Included for completeness; identical to PEAppResponse::addHeader().
PEAppResponse::containsHeader( name )
Returns true or false showing whether the named response header has already been set.
PEAppResponse::getArchiveFlag
Returns the value of the archive flag, which determines whether the transaction will be archived. When set to true, the transaction will be archived. If it’s set to false, the transaction will not be archived.
PEAppResponse::getAlternateArchiveFlag
Returns the value of the alternate archive flag, which determines whether the transaction will be archived in an alternate location. When set to 1, the transaction will be archived, provided the alternate location is set up in e3config.xml. If it’s set to 0, the transaction will not be archived in an alternate location.
PEAppResponse::getCharacterEncoding( )
Returns the name of the character encoding used for the MIME body to be sent in this response.
PEAppResponse::getCode( )
Returns the HTTP response code that will be transmitted to the client.
PEAppResponse::getHeaderNames( array[] )
Returns an array of a list of all response headers that have been set.
PEAppResponse::getHeaderValues( name )
Returns an array of a list of all header values stored for header name.
PEAppResponse::getLocale( )
Returns the name of the locale assigned to this response.
PEAppResponse::getOutputFile( )
Returns the absolute path to the file that's currently defined for transmission to the client. It returns an empty string if PEAppResponse::setOutputFile() hasn't been called.
PEAppResponse::getState( )
Returns a code indicating what will be returned to the client. States are as follows:
1: Returns a fabricated HTML page based upon the status code
2: Returns a fabricated HTML page based upon the status code and error message
3: Returns the status code, HTTP headers, and HTML page set using PEAppRequest::setOutputPage()
4: Returns the status code, HTTP headers, and output file specified using PEAppRequest::setOutputFile(). The output file will not be deleted after transmission to the client.
5: Same as state 4, but after transmitting the output file, it's deleted.
6: Sends a temporary redirect to the client.
PEAppResponse::getString( )
Returns the response string buffer, or an empty string if the buffer is empty.
PEAppResponse::hasResultFile( )
Returns true or false showing whether this response will or will not return a file (i.e., state is 4 or 5).
PEAppResponse::hasStringResult( )
Returns true or false showing whether this response has or does not have a string to return (i.e., state is 3).
PEAppResponse::reset( )
Clears the string buffer and output file, and sets the state to 1.
PEAppResponse::sendError( code )
Resets the response, then stores status code code and sets state to 1.
PEAppResponse::sendErrorMsg( code, message )
Resets the response, then stores the status code and error message, and sets state to 2.
PEAppResponse ::sendRedirect( location)
Resets the response, sets state to 6, and then saves location as the URL to which the client should be redirected.
PEAppResponse::setArchiveFlag
Returns the value of the archive flag. When set to true, the transaction can be archived. If it’s set to false, the transaction will not be archived.
PEAppResponse::setAlternateArchiveFlag
Returns the value of the alternate archive flag. When set to 1, the transaction will be archived, provided the alternate location is set up in e3config.xml. If it’s set to 0, the transaction will not be archived in an alternate location.
PEAppResponse::setContentLength( length )
Sets the HTTP Content-Length response header.
PEAppResponse::setContentType( type )
Sets the HTTP Content-Type response header.
PEAppResponse::setDateheader( name, value )
Sets the HTTP response header name to value, which should be a time/date expressed as the number of milliseconds since 0:00, January 1, 1970 or a time/date string the Java layer can convert.
PEAppResponse::setHeader( name, value )
Sets the HTTP response header name to value.
PEAppResponse::setIntHeader( name, value )
Included for completeness; same as PEAppResponse::setHeader
PEAppResponse::setLocale( name )
Sets the response locale, updating HTTP headers as appropriate.
PEAppResponse::setOutputFile( path, delete )
Configures the response to return the file path (which should be absolute). If delete is 0, the file is not deleted after transmission; otherwise the file is deleted after transmission. Sets the response state to 4 or 5, depending upon the value of delete.
PEAppResponse::setOutputPage( page )
Configures the response to return the string page as the response body. Sets the response state to 3.
PEAppResponse::setStatus( value )
Sets the status to be returned with the response to value.