public final class Response extends Object
Modifier and Type | Field and Description |
---|---|
ActionHook |
hook
Action hook.
|
Constructor and Description |
---|
Response() |
Modifier and Type | Method and Description |
---|---|
void |
acknowledge() |
void |
action(ActionCode actionCode,
Object param) |
void |
addHeader(String name,
String value) |
boolean |
containsHeader(String name)
Does the response contain the given header.
|
void |
doWrite(ByteChunk chunk)
Write a chunk of bytes.
|
void |
finish() |
long |
getBytesWritten(boolean flush)
Bytes written to socket - i.e. after compression, chunking, etc.
|
String |
getCharacterEncoding() |
long |
getCommitTime()
Return the time the response was committed (based on System.currentTimeMillis).
|
String |
getContentLanguage()
Return the content language.
|
int |
getContentLength() |
long |
getContentLengthLong() |
String |
getContentType() |
long |
getContentWritten()
Bytes written by application - i.e. before compression, chunking, etc.
|
Exception |
getErrorException()
Get the Exception that occurred during request processing.
|
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 |
isError()
Error flag accessor.
|
boolean |
isErrorReportRequired() |
boolean |
isExceptionPresent() |
void |
recycle() |
void |
reset() |
void |
sendHeaders()
Signal that we're done with the headers, and body will follow.
|
void |
setCharacterEncoding(String characterEncoding)
Overrides the character encoding used in the body of the response.
|
void |
setCommitted(boolean v) |
void |
setContentLength(long contentLength) |
void |
setContentType(String type)
Sets the content type.
|
void |
setContentTypeNoCharset(String type) |
boolean |
setError()
Set the error flag.
|
void |
setErrorException(Exception ex)
Set the error Exception that occurred during request processing.
|
boolean |
setErrorReported() |
void |
setHeader(String name,
String value) |
void |
setHook(ActionHook hook) |
void |
setLocale(Locale locale)
Called explicitly 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.
|
public volatile ActionHook hook
public Request getRequest()
public void setRequest(Request req)
public OutputBuffer getOutputBuffer()
public void setOutputBuffer(OutputBuffer outputBuffer)
public MimeHeaders getMimeHeaders()
public ActionHook getHook()
public void setHook(ActionHook hook)
public final void setNote(int pos, Object value)
public final Object getNote(int pos)
public void action(ActionCode actionCode, Object param)
public int getStatus()
public void setStatus(int status)
status
- The status value to setpublic String getMessage()
public void setMessage(String message)
message
- The status message to setpublic boolean isCommitted()
public void setCommitted(boolean v)
public long getCommitTime()
public void setErrorException(Exception ex)
ex
- The exception that occurredpublic Exception getErrorException()
public boolean isExceptionPresent()
public boolean setError()
false
if the error flag was already setpublic boolean isError()
true
if the response has encountered an errorpublic boolean isErrorReportRequired()
public boolean setErrorReported()
public void reset() throws IllegalStateException
IllegalStateException
public void finish()
public void acknowledge()
public boolean containsHeader(String name)
false
for Content-Type
and Content-Length.name
- The name of the header of interesttrue
if the response contains the header.public void sendHeaders()
public Locale getLocale()
public void setLocale(Locale locale)
locale
- The locale to use for this responsepublic String getContentLanguage()
public void setCharacterEncoding(String characterEncoding)
characterEncoding
- The name of character encoding.public String getCharacterEncoding()
public void setContentType(String type)
type
- the content typepublic void setContentTypeNoCharset(String type)
public String getContentType()
public void setContentLength(long contentLength)
public int getContentLength()
public long getContentLengthLong()
public void doWrite(ByteChunk chunk) throws IOException
IOException
public void recycle()
public long getContentWritten()
public long getBytesWritten(boolean flush)
flush
- Should any remaining bytes be flushed before returning the
total? If false
bytes remaining in the buffer will
not be included in the returned valueCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.