org.enhydra.servlet.connectionMethods.EnhydraDirector
Class DirectorHttpResponse

java.lang.Object
  extended byorg.mortbay.http.HttpMessage
      extended byorg.mortbay.http.HttpResponse
          extended byorg.enhydra.servlet.connectionMethods.EnhydraDirector.DirectorHttpResponse

public class DirectorHttpResponse
extends org.mortbay.http.HttpResponse

Author:
Milin Radivoj

Nested Class Summary
 
Nested classes inherited from class org.mortbay.http.HttpMessage
org.mortbay.http.HttpMessage.HeaderWriter
 
Field Summary
 
Fields inherited from class org.mortbay.http.HttpResponse
__100_Continue, __101_Switching_Protocols, __102_Processing, __200_OK, __201_Created, __202_Accepted, __203_Non_Authoritative_Information, __204_No_Content, __205_Reset_Content, __206_Partial_Content, __207_Multi_Status, __300_Multiple_Choices, __301_Moved_Permanently, __302_Found, __302_Moved_Temporarily, __303_See_Other, __304_Not_Modified, __305_Use_Proxy, __400_Bad_Request, __401_Unauthorized, __402_Payment_Required, __403_Forbidden, __404_Not_Found, __405_Method_Not_Allowed, __406_Not_Acceptable, __407_Proxy_Authentication_Required, __408_Request_Timeout, __409_Conflict, __410_Gone, __411_Length_Required, __412_Precondition_Failed, __413_Request_Entity_Too_Large, __414_Request_URI_Too_Large, __415_Unsupported_Media_Type, __416_Requested_Range_Not_Satisfiable, __417_Expectation_Failed, __422_Unprocessable_Entity, __423_Locked, __424_Failed_Dependency, __500_Internal_Server_Error, __501_Not_Implemented, __502_Bad_Gateway, __503_Service_Unavailable, __504_Gateway_Timeout, __505_HTTP_Version_Not_Supported, __507_Insufficient_Storage, __statusMsg
 
Fields inherited from class org.mortbay.http.HttpMessage
__HTTP_0_9, __HTTP_1_0, __HTTP_1_1, __HTTP_1_X, __MSG_BAD, __MSG_EDITABLE, __MSG_RECEIVED, __MSG_SENDING, __MSG_SENT, __SCHEME, __SSL_SCHEME, __state, _attributes, _characterEncoding, _connection, _dotVersion, _header, _mimeType, _state, _version, _wrapper
 
Constructor Summary
DirectorHttpResponse(EnhydraDirectorConnection conn, EnhydraConnection base)
           
 
Method Summary
 void addDateField(java.lang.String name, java.util.Date date)
          Adds the value of a date field.
 void addDateField(java.lang.String name, long date)
          Add the value of a date field.
 void addField(java.lang.String name, java.lang.String value)
          Add to a multi-value field value.
 void addIntField(java.lang.String name, int value)
          Adds the value of an integer field.
 void addSetCookie(javax.servlet.http.Cookie cookie)
          Add a Set-Cookie field.
 void addSetCookie(java.lang.String name, java.lang.String value)
          Add a Set-Cookie field.
 void commit()
           
 boolean containsField(java.lang.String name)
           
 void destroy()
          Destroy the message.
 void flushBuffer()
           
 java.lang.Object getAttribute(java.lang.String name)
          Get a request attribute.
 java.util.Enumeration getAttributeNames()
          Get Attribute names.
 java.lang.String getCharacterEncoding()
          Character Encoding.
 int getContentLength()
           
 java.lang.String getContentType()
           
 javax.servlet.http.Cookie[] getCookies()
           
 long getDateField(java.lang.String name)
          Get a header as a date value.
 java.lang.String getField(java.lang.String name)
          Get a value of header.
 java.util.Enumeration getFieldNames()
          Get Header Names.
 java.util.Enumeration getFieldValues(java.lang.String name)
          Get a values of header.
 java.util.Enumeration getFieldValues(java.lang.String name, java.lang.String separators)
          Get a values of header.
 java.io.InputStream getInputStream()
           
 int getIntField(java.lang.String name)
          Get a field as an integer value.
 java.io.OutputStream getOutputStream()
           
 int getStatus()
           
 java.io.PrintWriter getWriter()
           
 boolean isCommitted()
           
 boolean isDirty()
           
 void removeAttribute(java.lang.String name)
          Remove a request attribute.
 java.lang.String removeField(java.lang.String name)
          Remove a field.
 void reset()
           
 void resetBuffer()
           
 void sendError(int code)
          Sends an error response to the client using the specified status code and no default message.
 void sendError(int code, java.lang.String message)
          Send Error Response.
 void sendRedirect(java.lang.String location)
          Sends a redirect response to the client using the specified redirect location URL.
 java.lang.Object setAttribute(java.lang.String name, java.lang.Object attribute)
          Set a request attribute.
 void setCharacterEncoding(java.lang.String encoding, boolean setField)
          Set Character Encoding.
 void setContentLength(int len)
           
 void setContentType(java.lang.String contentType)
           
 void setDateField(java.lang.String name, java.util.Date date)
          Sets the value of a date field.
 void setDateField(java.lang.String name, long date)
          Sets the value of a date field.
 void setField(java.lang.String name, java.util.List value)
          Set a multi-value field value.
 java.lang.String setField(java.lang.String name, java.lang.String value)
          Set a field value.
 void setIntField(java.lang.String name, int value)
          Sets the value of an integer field.
 void setStatus(int status)
           
 void setStatus(int code, java.lang.String message)
           
 java.lang.String toString()
           
 
Methods inherited from class org.mortbay.http.HttpResponse
completing, getHttpContext, getHttpRequest, getReason, getRequest, readHeader, setHttpContext, setReason, writeHeader
 
Methods inherited from class org.mortbay.http.HttpMessage
getDotVersion, getHeader, getHttpConnection, getMimeType, getState, getVersion, getWrapper, setState, setVersion, setWrapper, updateMimeType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectorHttpResponse

public DirectorHttpResponse(EnhydraDirectorConnection conn,
                            EnhydraConnection base)
Method Detail

getCookies

public javax.servlet.http.Cookie[] getCookies()

getInputStream

public java.io.InputStream getInputStream()

getOutputStream

public java.io.OutputStream getOutputStream()

flushBuffer

public void flushBuffer()

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Throws:
java.io.IOException

resetBuffer

public void resetBuffer()

getFieldNames

public java.util.Enumeration getFieldNames()
Get Header Names.

Returns:
Enumeration of Header Names

containsField

public boolean containsField(java.lang.String name)

getField

public java.lang.String getField(java.lang.String name)
Get a value of header.

Parameters:
name -
Returns:
field value or null

getFieldValues

public java.util.Enumeration getFieldValues(java.lang.String name)
Get a values of header.

Parameters:
name -
Returns:
Enumeration of field values or null

getFieldValues

public java.util.Enumeration getFieldValues(java.lang.String name,
                                            java.lang.String separators)
Get a values of header.

Parameters:
name -
separators - String of separators.
Returns:
Enumeration of values or null

setField

public java.lang.String setField(java.lang.String name,
                                 java.lang.String value)
Set a field value.

Parameters:
name - Name of field
value - New value of field
Returns:
Old value of field

setField

public void setField(java.lang.String name,
                     java.util.List value)
Set a multi-value field value.

Parameters:
name - Name of field
value - New values of field

addField

public void addField(java.lang.String name,
                     java.lang.String value)
              throws java.lang.IllegalStateException
Add to a multi-value field value.

Parameters:
name - Name of field
value - New value to add to the field
Throws:
java.lang.IllegalStateException - Not editable or sending 1.1 with trailers

getIntField

public int getIntField(java.lang.String name)
Get a field as an integer value.

Parameters:
name - the case-insensitive field name

setIntField

public void setIntField(java.lang.String name,
                        int value)
Sets the value of an integer field.

Parameters:
name - the field name
value - the field integer value

addIntField

public void addIntField(java.lang.String name,
                        int value)
Adds the value of an integer field.

Parameters:
name - the field name
value - the field integer value

getDateField

public long getDateField(java.lang.String name)
Get a header as a date value.

Parameters:
name - the case-insensitive field name

setDateField

public void setDateField(java.lang.String name,
                         java.util.Date date)
Sets the value of a date field.

Parameters:
name - the field name
date - the field date value

addDateField

public void addDateField(java.lang.String name,
                         java.util.Date date)
Adds the value of a date field.

Parameters:
name - the field name
date - the field date value

setDateField

public void setDateField(java.lang.String name,
                         long date)
Sets the value of a date field.

Parameters:
name - the field name
date - the field date value

addDateField

public void addDateField(java.lang.String name,
                         long date)
Add the value of a date field.

Parameters:
name - the field name
date - the field date value
Throws:
java.lang.IllegalStateException - Not editable or sending 1.1 with trailers

removeField

public java.lang.String removeField(java.lang.String name)
                             throws java.lang.IllegalStateException
Remove a field.

Parameters:
name - Name of field
Returns:
Old value of field
Throws:
java.lang.IllegalStateException

getContentLength

public int getContentLength()

setContentLength

public void setContentLength(int len)

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Character Encoding.

Returns:
Character Encoding

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding,
                                 boolean setField)
Set Character Encoding.


getContentType

public java.lang.String getContentType()

setContentType

public void setContentType(java.lang.String contentType)

destroy

public void destroy()
Destroy the message. Help the garbage collector by nulling everything that we can.


toString

public java.lang.String toString()

isCommitted

public boolean isCommitted()

isDirty

public boolean isDirty()

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Get a request attribute.

Parameters:
name - Attribute name
Returns:
Attribute value

setAttribute

public java.lang.Object setAttribute(java.lang.String name,
                                     java.lang.Object attribute)
Set a request attribute.

Parameters:
name - Attribute name
attribute - Attribute value
Returns:
Previous Attribute value

getAttributeNames

public java.util.Enumeration getAttributeNames()
Get Attribute names.

Returns:
Enumeration of Strings

removeAttribute

public void removeAttribute(java.lang.String name)
Remove a request attribute.

Parameters:
name - Attribute name

reset

public void reset()

getStatus

public int getStatus()

setStatus

public void setStatus(int status)

setStatus

public void setStatus(int code,
                      java.lang.String message)

sendError

public void sendError(int code,
                      java.lang.String message)
               throws java.io.IOException
Send Error Response.

Throws:
java.io.IOException

sendError

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

Parameters:
code - the status code
Throws:
java.io.IOException - If an I/O error has occurred.

sendRedirect

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

Parameters:
location - the redirect location URL
Throws:
java.io.IOException - If an I/O error has occurred.

addSetCookie

public void addSetCookie(java.lang.String name,
                         java.lang.String value)
Add a Set-Cookie field.


addSetCookie

public void addSetCookie(javax.servlet.http.Cookie cookie)
Add a Set-Cookie field.


commit

public void commit()
            throws java.io.IOException
Throws:
java.io.IOException