org.enhydra.servlet.connectionMethods.EnhydraDirector
Class DirectorResponse

java.lang.Object
  extended byorg.apache.catalina.connector.Response
      extended byorg.enhydra.servlet.connectionMethods.EnhydraDirector.DirectorResponse
All Implemented Interfaces:
javax.servlet.http.HttpServletResponse, javax.servlet.ServletResponse

public class DirectorResponse
extends org.apache.catalina.connector.Response

Enhydra Director implementation of the response.

Author:
Milin Radivoj

Field Summary
protected  EnhydraDirectorConnection connection
           
 
Fields inherited from class org.apache.catalina.connector.Response
appCommitted, connector, cookies, coyoteResponse, error, facade, format, included, info, outputBuffer, outputStream, redirectURLCC, request, sm, urlEncoder, usingOutputStream, usingWriter, writer
 
Fields inherited from interface javax.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
 
Constructor Summary
DirectorResponse(EnhydraDirectorConnection res)
           
 
Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
          Add the Cookie to this Response.
 void addDateHeader(java.lang.String name, long date)
          Adds a response header with the given name and date-value.
 void addHeader(java.lang.String name, java.lang.String value)
          Adds a response header with the given name and value.
 void addIntHeader(java.lang.String name, int value)
          Adds a response header with the given name and integer value.
 boolean containsHeader(java.lang.String name)
          Returns a boolean indicating whether the named response header has already been set.
 javax.servlet.ServletOutputStream createOutputStream()
          Create and return a ServletOutputStream to write the content associated with this Response.
 java.lang.String encodeRedirectUrl(java.lang.String url)
           
 java.lang.String encodeRedirectURL(java.lang.String url)
          Encodes the specified URL for use in the sendRedirect method or
 java.lang.String encodeUrl(java.lang.String url)
           
 java.lang.String encodeURL(java.lang.String url)
          Encodes the specified URL by including the session ID in it
 void finishResponse()
          Perform whatever actions are required to close the output
 void flushBuffer()
          Forces any content in the buffer to be written to the client.
 int getBufferSize()
          Returns the actual buffer size used for the response.
 java.lang.String getCharacterEncoding()
          Returns the name of the character encoding (MIME charset) used for the body sent in this response.
 int getContentCount()
          Return the number of bytes actually written to the output stream.
 int getContentLength()
          Return the content length that was set or calculated for this Response.
 java.lang.String getContentType()
          Returns the content type used for the MIME body sent in this response.
 javax.servlet.http.Cookie[] getCookies()
          Get the Cookies associated with this Response.
 java.lang.String getHeader(java.lang.String name)
          Get the Header with the specified name associated with this Response.
 java.lang.String[] getHeaderNames()
          Get the Header Names associated with this Response.
 java.lang.String[] getHeaderValues(java.lang.String name)
          Get the Header Values with the specified name associated with this Response.
 java.lang.String getInfo()
          Return descriptive information about this Response implementation
 java.lang.String getMessage()
          Get the Message associated with this Response.
 javax.servlet.ServletOutputStream getOutputStream()
          Returns a ServletOutputStream suitable for writing binary data in the response.
 java.io.PrintWriter getReporter()
          Return a PrintWriter that can be used to render error messages
 int getStatus()
          Get the Status associated with this Response.
 java.io.OutputStream getStream()
          Return the output stream associated with this Response.
 java.io.PrintWriter getWriter()
          Returns a PrintWriter object that can send character text to the client.
 boolean isCommitted()
          Returns a boolean indicating if the response has been committed.
 void recycle()
          Release all object references, and initialize instance variables, in preparation for reuse of this object.
 void reset()
          Clears any data that exists in the buffer as well as the status code and headers.
 void reset(int status, java.lang.String message)
           
 void resetBuffer()
          Clears the content of the underlying buffer in the response without clearing headers or status code.
 void sendAcknowledgement()
          Send an acknowledgment of a request.
 void sendError(int sc)
          Sends an error response to the client using the specified status code
 void sendError(int sc, java.lang.String msg)
          Sends an error response to the client using the specified status.
 void sendRedirect(java.lang.String location)
          Sends a temporary redirect response to the client using the specified redirect location URL.
 void setBufferSize(int size)
          Sets the preferred buffer size for the body of the response.
 void setCharacterEncoding(java.lang.String charset)
           
 void setContentLength(int len)
          Sets the length of the content body in the response
 void setContentType(java.lang.String type)
          Sets the content type of the response being sent to the client, if the response has not been committed yet.
 void setDateHeader(java.lang.String name, long date)
          Sets a response header with the given name and date-value.
 void setHeader(java.lang.String name, java.lang.String value)
          Sets a response header with the given name and value.
 void setIntHeader(java.lang.String name, int value)
          Sets a response header with the given name and integer value.
 void setStatus(int sc)
          Sets the status code for this response.
 void setStatus(int sc, java.lang.String sm)
           
 void setStream(java.io.OutputStream stream)
          Set the output stream associated with this Response.
 
Methods inherited from class org.apache.catalina.connector.Response
getConnector, getContext, getCoyoteResponse, getIncluded, getLocale, getRequest, getResponse, isAppCommitted, isEncodeable, isError, isSuspended, setAppCommitted, setConnector, setContext, setCoyoteResponse, setError, setIncluded, setLocale, setRequest, setSuspended, toEncoded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected EnhydraDirectorConnection connection
Constructor Detail

DirectorResponse

public DirectorResponse(EnhydraDirectorConnection res)
Method Detail

getContentCount

public int getContentCount()
Return the number of bytes actually written to the output stream.


getInfo

public java.lang.String getInfo()
Return descriptive information about this Response implementation


getStream

public java.io.OutputStream getStream()
Return the output stream associated with this Response.


setStream

public void setStream(java.io.OutputStream stream)
Set the output stream associated with this Response.


createOutputStream

public javax.servlet.ServletOutputStream createOutputStream()
                                                     throws java.io.IOException
Create and return a ServletOutputStream to write the content associated with this Response.

Throws:
java.io.IOException

finishResponse

public void finishResponse()
                    throws java.io.IOException
Perform whatever actions are required to close the output

Throws:
java.io.IOException

getContentLength

public int getContentLength()
Return the content length that was set or calculated for this Response.


getReporter

public java.io.PrintWriter getReporter()
                                throws java.io.IOException
Return a PrintWriter that can be used to render error messages

Throws:
java.io.IOException

recycle

public void recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.


sendAcknowledgement

public void sendAcknowledgement()
                         throws java.io.IOException
Send an acknowledgment of a request.

Throws:
java.io.IOException

getCookies

public javax.servlet.http.Cookie[] getCookies()
Get the Cookies associated with this Response.


getHeader

public java.lang.String getHeader(java.lang.String name)
Get the Header with the specified name associated with this Response.


getHeaderNames

public java.lang.String[] getHeaderNames()
Get the Header Names associated with this Response.


getHeaderValues

public java.lang.String[] getHeaderValues(java.lang.String name)
Get the Header Values with the specified name associated with this Response.


getMessage

public java.lang.String getMessage()
Get the Message associated with this Response.


getStatus

public int getStatus()
Get the Status associated with this Response.


reset

public void reset(int status,
                  java.lang.String message)

addCookie

public void addCookie(javax.servlet.http.Cookie cookie)
Add the Cookie to this Response.


containsHeader

public boolean containsHeader(java.lang.String name)
Returns a boolean indicating whether the named response header has already been set.


encodeURL

public java.lang.String encodeURL(java.lang.String url)
Encodes the specified URL by including the session ID in it


encodeRedirectURL

public java.lang.String encodeRedirectURL(java.lang.String url)
Encodes the specified URL for use in the sendRedirect method or


encodeUrl

public java.lang.String encodeUrl(java.lang.String url)

encodeRedirectUrl

public java.lang.String encodeRedirectUrl(java.lang.String url)

sendError

public void sendError(int sc,
                      java.lang.String msg)
               throws java.io.IOException
Sends an error response to the client using the specified status.

Throws:
java.io.IOException

sendError

public void sendError(int sc)
               throws java.io.IOException
Sends an error response to the client using the specified status code

Throws:
java.io.IOException

sendRedirect

public void sendRedirect(java.lang.String location)
                  throws java.io.IOException
Sends a temporary redirect response to the client using the specified redirect location URL.

Throws:
java.io.IOException

setDateHeader

public void setDateHeader(java.lang.String name,
                          long date)
Sets a response header with the given name and date-value.


addDateHeader

public void addDateHeader(java.lang.String name,
                          long date)
Adds a response header with the given name and date-value.


setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Sets a response header with the given name and value.


addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Adds a response header with the given name and value.


setIntHeader

public void setIntHeader(java.lang.String name,
                         int value)
Sets a response header with the given name and integer value.


addIntHeader

public void addIntHeader(java.lang.String name,
                         int value)
Adds a response header with the given name and integer value.


setStatus

public void setStatus(int sc)
Sets the status code for this response.


setStatus

public void setStatus(int sc,
                      java.lang.String sm)

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Returns the name of the character encoding (MIME charset) used for the body sent in this response.


getContentType

public java.lang.String getContentType()
Returns the content type used for the MIME body sent in this response.


getOutputStream

public javax.servlet.ServletOutputStream getOutputStream()
                                                  throws java.io.IOException
Returns a ServletOutputStream suitable for writing binary data in the response.

Throws:
java.io.IOException

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Returns a PrintWriter object that can send character text to the client.

Throws:
java.io.IOException

setCharacterEncoding

public void setCharacterEncoding(java.lang.String charset)

setContentLength

public void setContentLength(int len)
Sets the length of the content body in the response


setContentType

public void setContentType(java.lang.String type)
Sets the content type of the response being sent to the client, if the response has not been committed yet.


setBufferSize

public void setBufferSize(int size)
Sets the preferred buffer size for the body of the response.


getBufferSize

public int getBufferSize()
Returns the actual buffer size used for the response.


flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Forces any content in the buffer to be written to the client.

Throws:
java.io.IOException

resetBuffer

public void resetBuffer()
Clears the content of the underlying buffer in the response without clearing headers or status code.


isCommitted

public boolean isCommitted()
Returns a boolean indicating if the response has been committed.


reset

public void reset()
Clears any data that exists in the buffer as well as the status code and headers.