org.apache.coyote

Class Response


public final class Response
extends java.lang.Object

Response object.

Authors:
James Duncan Davidson [duncan@eng.sun.com]
Jason Hunter [jch@eng.sun.com]
James Todd [gonzo@eng.sun.com]
Harish Prabandham
Hans Bergsten
Remy Maucherat

Field Summary

protected String
characterEncoding
protected boolean
charsetSet
Has the charset been explicitly set.
protected boolean
commited
Committed flag.
protected String
contentLanguage
protected int
contentLength
protected String
contentType
HTTP specific fields.
protected Exception
errorException
Holds request error exception.
protected String
errorURI
Request error URI.
protected MimeHeaders
headers
Response headers.
ActionHook
hook
Action hook.
protected String
message
Status message.
protected Object[]
notes
Notes.
protected OutputBuffer
outputBuffer
Associated output buffer.
protected Request
req
protected int
status
Status code.

Constructor Summary

Response()

Method Summary

void
acknowledge()
void
action(ActionCode actionCode, Object param)
void
addHeader(String name, String value)
boolean
containsHeader(String name)
void
doWrite(ByteChunk chunk)
Write a chunk of bytes.
void
finish()
long
getBytesWritten()
String
getCharacterEncoding()
String
getContentLanguage()
Return the content language.
int
getContentLength()
String
getContentType()
Exception
getErrorException()
Get the Exception that occurred during request processing.
String
getErrorURI()
Get the request URI that caused the original error.
ActionHook
getHook()
Locale
getLocale()
String
getMessage()
Get the status message.
MimeHeaders
getMimeHeaders()
Object
getNote(int pos)
OutputBuffer
getOutputBuffer()
Request
getRequest()
int
getStatus()
boolean
isCommitted()
boolean
isExceptionPresent()
void
recycle()
void
reset()
void
sendHeaders()
Signal that we're done with the headers, and body will follow.
void
setBytesWritten(long bytesWritten)
void
setCharacterEncoding(String charset)
void
setCommitted(boolean v)
void
setContentLength(int contentLength)
void
setContentType(String type)
Sets the content type.
void
setErrorException(Exception ex)
Set the error Exception that occurred during request processing.
void
setErrorURI(String uri)
Set request URI that caused an error during request processing.
void
setHeader(String name, String value)
void
setHook(ActionHook hook)
void
setLocale(Locale locale)
Called explicitely by user to set the Content-Language and the default encoding
void
setMessage(String message)
Set the status message.
void
setNote(int pos, Object value)
void
setOutputBuffer(OutputBuffer outputBuffer)
void
setRequest(Request req)
void
setStatus(int status)
Set the response status

Field Details

characterEncoding

protected String characterEncoding


charsetSet

protected boolean charsetSet
Has the charset been explicitly set.


commited

protected boolean commited
Committed flag.


contentLanguage

protected String contentLanguage


contentLength

protected int contentLength


contentType

protected String contentType
HTTP specific fields.


errorException

protected Exception errorException
Holds request error exception.


errorURI

protected String errorURI
Request error URI.


headers

protected MimeHeaders headers
Response headers.


hook

public ActionHook hook
Action hook.


message

protected String message
Status message.


notes

protected Object[] notes
Notes.


outputBuffer

protected OutputBuffer outputBuffer
Associated output buffer.


req

protected Request req


status

protected int status
Status code.

Constructor Details

Response

public Response()

Method Details

acknowledge

public void acknowledge()
            throws IOException


action

public void action(ActionCode actionCode,
                   Object param)


addHeader

public void addHeader(String name,
                      String value)


containsHeader

public boolean containsHeader(String name)


doWrite

public void doWrite(ByteChunk chunk)
            throws IOException
Write a chunk of bytes.


finish

public void finish()
            throws IOException


getBytesWritten

public long getBytesWritten()


getCharacterEncoding

public String getCharacterEncoding()


getContentLanguage

public String getContentLanguage()
Return the content language.


getContentLength

public int getContentLength()


getContentType

public String getContentType()


getErrorException

public Exception getErrorException()
Get the Exception that occurred during request processing.


getErrorURI

public String getErrorURI()
Get the request URI that caused the original error.


getHook

public ActionHook getHook()


getLocale

public Locale getLocale()


getMessage

public String getMessage()
Get the status message.


getMimeHeaders

public MimeHeaders getMimeHeaders()


getNote

public final Object getNote(int pos)


getOutputBuffer

public OutputBuffer getOutputBuffer()


getRequest

public Request getRequest()


getStatus

public int getStatus()


isCommitted

public boolean isCommitted()


isExceptionPresent

public boolean isExceptionPresent()


recycle

public void recycle()


reset

public void reset()
            throws IllegalStateException


sendHeaders

public void sendHeaders()
            throws IOException
Signal that we're done with the headers, and body will follow. Any implementation needs to notify ContextManager, to allow interceptors to fix headers.


setBytesWritten

public void setBytesWritten(long bytesWritten)


setCharacterEncoding

public void setCharacterEncoding(String charset)


setCommitted

public void setCommitted(boolean v)


setContentLength

public void setContentLength(int contentLength)


setContentType

public void setContentType(String type)
Sets the content type. This method must preserve any response charset that may already have been set via a call to response.setContentType(), response.setLocale(), or response.setCharacterEncoding().

Parameters:
type - the content type


setErrorException

public void setErrorException(Exception ex)
Set the error Exception that occurred during request processing.


setErrorURI

public void setErrorURI(String uri)
Set request URI that caused an error during request processing.


setHeader

public void setHeader(String name,
                      String value)


setHook

public void setHook(ActionHook hook)


setLocale

public void setLocale(Locale locale)
Called explicitely by user to set the Content-Language and the default encoding


setMessage

public void setMessage(String message)
Set the status message.


setNote

public final void setNote(int pos,
                          Object value)


setOutputBuffer

public void setOutputBuffer(OutputBuffer outputBuffer)


setRequest

public void setRequest(Request req)


setStatus

public void setStatus(int status)
Set the response status


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.