EAF 7.6 API

com.lutris.appserver.server.httpPresentation
Interface HttpPresentationResponse


public interface HttpPresentationResponse

Object passed to presentation objects that is used to generate HTTP responses.

Version:
$Revision: 1.3 $
Author:
Mark Diekhans

Field Summary
static int SC_ACCEPTED
          Status code (202) indicating that a request was accepted for processing, but was not completed.
static int SC_BAD_GATEWAY
          Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when acting as a proxy or gateway.
static int SC_BAD_REQUEST
          Status code (400) indicating the request sent by the client was syntactically incorrect.
static int SC_CREATED
          Status code (201) indicating the request succeeded and created a new resource on the server.
static int SC_FORBIDDEN
          Status code (403) indicating the server understood the request but refused to fulfill it.
static int SC_INTERNAL_SERVER_ERROR
          Status code (500) indicating an error inside the HTTP service which prevented it from fulfilling the request.
static int SC_MOVED_PERMANENTLY
          Status code (301) indicating that the resource has permanently moved to a new location, and that future references should use a new URI with their requests.
static int SC_MOVED_TEMPORARILY
          Status code (302) indicating that the resource has temporarily moved to another location, but that future references should still use the original URI to access the resource.
static int SC_NO_CONTENT
          Status code (204) indicating that the request succeeded but that there was no new information to return.
static int SC_NOT_FOUND
          Status code (404) indicating that the requested resource is not available.
static int SC_NOT_IMPLEMENTED
          Status code (501) indicating the HTTP service does not support the functionality needed to fulfill the request.
static int SC_NOT_MODIFIED
          Status code (304) indicating that a conditional GET operation found that the resource was available and not modified.
static int SC_OK
          Status code (200) indicating the request succeeded normally.
static int SC_SERVICE_UNAVAILABLE
          Status code (503) indicating that the HTTP service is temporarily overloaded, and unable to handle the request.
static int SC_UNAUTHORIZED
          Status code (401) indicating that the request requires HTTP authentication.
 
Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
          Adds the specified cookie to the response.
 boolean containsHeader(java.lang.String name)
          Returns true if the response message header has a field with the specified name.
 org.enhydra.xml.io.OutputOptions createOutputOptions(org.enhydra.xml.xmlc.XMLObject document)
          Create an OutputOptions object for a document.
 void flush()
          Called at the end of processing a response to force any cached headers to be written and buffers flushed.
 java.lang.String getEncoding()
          Get the output character encoding.
 javax.servlet.http.HttpServletResponse getHttpServletResponse()
          Returns the original HttpServletResponse.
 HttpPresentationOutputStream getOutputStream()
          Returns an output stream for writing response data.
 com.lutris.appserver.server.ResponsePostProcessingManager getPostProcessingManager()
          Returns the response post processing manager.
 boolean isSessionIdCookieRequired()
          Indicates whether client response requires a sessionId cookie
 boolean isSessionIdEncodeUrlRequired()
          Indicates whether client response requires url encoding for sessionId
 void sendError(int sc)
          Sends an error response to the client using the specified status code and a default message.
 void sendError(int sc, java.lang.String msg)
          Sends an error response to the client using the specified status code and descriptive message.
 void setContentLength(int len)
          Sets the content length for this response.
 void setContentType(java.lang.String type)
          Sets the content type for this response.
 void setDateHeader(java.lang.String name, long date)
          Adds a field to the response header with a given name and date-valued field.
 void setEncoding(java.lang.String enc)
          Set the output character encoding.
 void setHeader(java.lang.String name, java.lang.String value)
          Adds a field to the response header with a given name and value.
 void setIntHeader(java.lang.String name, int value)
          Adds a field to the response header with a given name and integer value.
 void setPostProcessingManager(com.lutris.appserver.server.ResponsePostProcessingManager processingManager)
          Sets the response post processing manager.
 void setSessionIdCookieRequired(boolean sessionIdCookie)
           
 void setSessionIdEncodeUrlRequired(boolean sessionIdUrl)
           
 void setSessionKey(java.lang.String sessionKey)
          Sets the current session key for this response
 void setSessionManager(SessionManager sessionManager)
          Sets the current application name for this response
 void setStatus(int sc)
          Sets the status code and a default message for this response.
 void setStatus(int sc, java.lang.String sm)
          Sets the status code and message for this response.
 void writeDOM(org.w3c.dom.Node document)
          Output an an XML document object (DOM).
 void writeDOM(org.enhydra.xml.io.OutputOptions outputOptions, org.w3c.dom.Node document)
          Output an an XML document object (DOM).
 void writeHTML(org.w3c.dom.html.HTMLDocument doc)
          Deprecated. use writeDOM
 void writeHTML(java.lang.String html)
          Utility method to output an HTML page.
 

Field Detail

SC_OK

static final int SC_OK
Status code (200) indicating the request succeeded normally.

See Also:
Constant Field Values

SC_CREATED

static final int SC_CREATED
Status code (201) indicating the request succeeded and created a new resource on the server.

See Also:
Constant Field Values

SC_ACCEPTED

static final int SC_ACCEPTED
Status code (202) indicating that a request was accepted for processing, but was not completed.

See Also:
Constant Field Values

SC_NO_CONTENT

static final int SC_NO_CONTENT
Status code (204) indicating that the request succeeded but that there was no new information to return.

See Also:
Constant Field Values

SC_MOVED_PERMANENTLY

static final int SC_MOVED_PERMANENTLY
Status code (301) indicating that the resource has permanently moved to a new location, and that future references should use a new URI with their requests.

See Also:
Constant Field Values

SC_MOVED_TEMPORARILY

static final int SC_MOVED_TEMPORARILY
Status code (302) indicating that the resource has temporarily moved to another location, but that future references should still use the original URI to access the resource.

See Also:
Constant Field Values

SC_NOT_MODIFIED

static final int SC_NOT_MODIFIED
Status code (304) indicating that a conditional GET operation found that the resource was available and not modified.

See Also:
Constant Field Values

SC_BAD_REQUEST

static final int SC_BAD_REQUEST
Status code (400) indicating the request sent by the client was syntactically incorrect.

See Also:
Constant Field Values

SC_UNAUTHORIZED

static final int SC_UNAUTHORIZED
Status code (401) indicating that the request requires HTTP authentication.

See Also:
Constant Field Values

SC_FORBIDDEN

static final int SC_FORBIDDEN
Status code (403) indicating the server understood the request but refused to fulfill it.

See Also:
Constant Field Values

SC_NOT_FOUND

static final int SC_NOT_FOUND
Status code (404) indicating that the requested resource is not available.

See Also:
Constant Field Values

SC_INTERNAL_SERVER_ERROR

static final int SC_INTERNAL_SERVER_ERROR
Status code (500) indicating an error inside the HTTP service which prevented it from fulfilling the request.

See Also:
Constant Field Values

SC_NOT_IMPLEMENTED

static final int SC_NOT_IMPLEMENTED
Status code (501) indicating the HTTP service does not support the functionality needed to fulfill the request.

See Also:
Constant Field Values

SC_BAD_GATEWAY

static final int SC_BAD_GATEWAY
Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when acting as a proxy or gateway.

See Also:
Constant Field Values

SC_SERVICE_UNAVAILABLE

static final int SC_SERVICE_UNAVAILABLE
Status code (503) indicating that the HTTP service is temporarily overloaded, and unable to handle the request.

See Also:
Constant Field Values
Method Detail

getHttpServletResponse

javax.servlet.http.HttpServletResponse getHttpServletResponse()
Returns the original HttpServletResponse.


setContentLength

void setContentLength(int len)
                      throws HttpPresentationException
Sets the content length for this response.

Parameters:
len - the content length
Throws:
HttpPresentationException

setContentType

void setContentType(java.lang.String type)
                    throws HttpPresentationException
Sets the content type for this response.

Parameters:
type - the content's MIME type
Throws:
HttpPresentationException

createOutputOptions

org.enhydra.xml.io.OutputOptions createOutputOptions(org.enhydra.xml.xmlc.XMLObject document)
                                                     throws HttpPresentationException
Create an OutputOptions object for a document. Options are default for the specified document. The object maybe then modified as needed to override the default values.

The following attributes are set in the object:

Throws:
HttpPresentationException

getOutputStream

HttpPresentationOutputStream getOutputStream()
                                             throws HttpPresentationException
Returns an output stream for writing response data.

Throws:
HttpPresentationException

addCookie

void addCookie(javax.servlet.http.Cookie cookie)
               throws HttpPresentationException
Adds the specified cookie to the response. It can be called multiple times to set more than one cookie.

Parameters:
cookie - - The Cookie to return to the client.
Throws:
HttpPresentationException

containsHeader

boolean containsHeader(java.lang.String name)
                       throws HttpPresentationException
Returns true if the response message header has a field with the specified name.

Parameters:
name - the header field name
Throws:
HttpPresentationException

setStatus

void setStatus(int sc,
               java.lang.String sm)
               throws HttpPresentationException
Sets the status code and message for this response.

Parameters:
sc - the status code
sm - the status message
Throws:
HttpPresentationException

setStatus

void setStatus(int sc)
               throws HttpPresentationException
Sets the status code and a default message for this response.

Parameters:
sc - the status code
Throws:
HttpPresentationException

setHeader

void setHeader(java.lang.String name,
               java.lang.String value)
               throws HttpPresentationException
Adds a field to the response header with a given name and value. If the field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
value - the header field value
Throws:
HttpPresentationException

setIntHeader

void setIntHeader(java.lang.String name,
                  int value)
                  throws HttpPresentationException
Adds a field to the response header with a given name and integer value. If the field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
value - the header field integer value
Throws:
HttpPresentationException

setDateHeader

void setDateHeader(java.lang.String name,
                   long date)
                   throws HttpPresentationException
Adds a field to the response header with a given name and date-valued field. The date is specified in terms of milliseconds since the epoch. If the date field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
value - the header field date value
Throws:
HttpPresentationException

sendError

void sendError(int sc,
               java.lang.String msg)
               throws HttpPresentationException
Sends an error response to the client using the specified status code and descriptive message.

Parameters:
sc - the status code
msg - the detail message
Throws:
HttpPresentationException

sendError

void sendError(int sc)
               throws HttpPresentationException
Sends an error response to the client using the specified status code and a default message.

Parameters:
sc - the status code
Throws:
HttpPresentationException

flush

void flush()
           throws HttpPresentationException
Called at the end of processing a response to force any cached headers to be written and buffers flushed. This maybe a no-op if no buffering is implemented. This is normally not called by a client.

Throws:
HttpPresentationException

writeDOM

void writeDOM(org.enhydra.xml.io.OutputOptions outputOptions,
              org.w3c.dom.Node document)
              throws HttpPresentationException
Output an an XML document object (DOM). The document is formatted according to it's type. The MIME type of the response is automatically set.

Parameters:
outputFormat - Object use to specify options controling formatting of the document.
doc - The DOM object to be returned as response.
Throws:
HttpPresentationException

writeDOM

void writeDOM(org.w3c.dom.Node document)
              throws HttpPresentationException
Output an an XML document object (DOM). The document is formatted according to it's type. The MIME type of the response is automatically set.

Parameters:
doc - The DOM object to be returned as response.
Throws:
HttpPresentationException

writeHTML

void writeHTML(java.lang.String html)
               throws HttpPresentationException
Utility method to output an HTML page. The appropriate headers are set for MIME type and to disable caching of the HTML by the broswer.

Throws:
HttpPresentationException

writeHTML

void writeHTML(org.w3c.dom.html.HTMLDocument doc)
               throws HttpPresentationException
Deprecated. use writeDOM

Utility method to output an HTML page from a DOM object. The appropriate headers are set for MIME type and to disable caching of the HTML by the broswer.

Parameters:
doc - The DOM object to be returned as response
Throws:
HttpPresentationException
See Also:
writeDOM(org.enhydra.xml.io.OutputOptions, org.w3c.dom.Node)

setEncoding

void setEncoding(java.lang.String enc)
Set the output character encoding.

Parameters:
enc - character encoding

getEncoding

java.lang.String getEncoding()
Get the output character encoding.

Returns:
the current encoding

setSessionKey

void setSessionKey(java.lang.String sessionKey)
Sets the current session key for this response

Parameters:
sessionKey - The current sessionKey

setSessionManager

void setSessionManager(SessionManager sessionManager)
Sets the current application name for this response

Parameters:
appName - The current application name

isSessionIdCookieRequired

boolean isSessionIdCookieRequired()
                                  throws HttpPresentationException
Indicates whether client response requires a sessionId cookie

Returns:
true if client response requires a sessionId cookie false otherwise
Throws:
HttpPresentationException

setSessionIdCookieRequired

void setSessionIdCookieRequired(boolean sessionIdCookie)
                                throws HttpPresentationException
Throws:
HttpPresentationException

isSessionIdEncodeUrlRequired

boolean isSessionIdEncodeUrlRequired()
                                     throws HttpPresentationException
Indicates whether client response requires url encoding for sessionId

Returns:
true if client response requires url encoding for sessionId; false otherwise
Throws:
HttpPresentationException

setSessionIdEncodeUrlRequired

void setSessionIdEncodeUrlRequired(boolean sessionIdUrl)
                                   throws HttpPresentationException
Throws:
HttpPresentationException

setPostProcessingManager

void setPostProcessingManager(com.lutris.appserver.server.ResponsePostProcessingManager processingManager)
Sets the response post processing manager.

Parameters:
processingManager -

getPostProcessingManager

com.lutris.appserver.server.ResponsePostProcessingManager getPostProcessingManager()
Returns the response post processing manager.


EAF 7.6 API