|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.messagelet.impl.ServletResponseImpl
public class ServletResponseImpl
Based on the ResponseBase code from Catalina.
Field Summary | |
---|---|
protected byte[] |
buffer
The buffer through which all of our output bytes are passed. |
protected int |
bufferCount
The number of data bytes currently in the buffer. |
protected boolean |
committed
Has this response been committed yet? |
protected int |
contentCount
The actual number of bytes written to this Response. |
protected int |
contentLength
The content length associated with this Response. |
protected String |
contentType
The content type associated with this Response. |
protected String |
encoding
The character encoding associated with this Response. |
protected boolean |
error
Error flag. |
protected boolean |
included
Are we currently processing inside a RequestDispatcher.include()? |
protected Locale |
locale
The Locale associated with this Response. |
protected OutputStream |
output
The output stream associated with this Response. |
protected javax.servlet.ServletOutputStream |
stream
The ServletOutputStream that has been returned by getOutputStream() , if any. |
protected PrintWriter |
writer
The PrintWriter that has been returned by getWriter() , if any. |
Constructor Summary | |
---|---|
ServletResponseImpl()
|
Method Summary | |
---|---|
javax.servlet.ServletOutputStream |
createOutputStream()
Create and return a ServletOutputStream to write the content associated with this Response. |
void |
finishResponse()
Perform whatever actions are required to flush and close the output stream or writer, in a single operation. |
void |
flushBuffer()
Flush the buffer and commit this response. |
int |
getBufferSize()
Return the actual buffer size used for this Response. |
String |
getCharacterEncoding()
Return the character encoding used for 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. |
String |
getContentType()
Return the content type that was set or calculated for this response, or null if no content type was set. |
Locale |
getLocale()
Return the Locale assigned to this response. |
javax.servlet.ServletOutputStream |
getOutputStream()
Return the servlet output stream associated with this Response. |
OutputStream |
getStream()
Return the output stream associated with this Response. |
PrintWriter |
getWriter()
Return the writer associated with this Response. |
boolean |
isCommitted()
Has the output of this response already been committed? |
void |
reset()
Clear any content written to the buffer. |
void |
resetBuffer()
Reset the data buffer but not any status or header information. |
void |
setBufferSize(int size)
Set the buffer size to be used for this Response. |
void |
setContentLength(int length)
Set the content length (in bytes) for this Response. |
void |
setContentType(String type)
Set the content type for this Response. |
void |
setLocale(Locale locale)
Set the Locale that is appropriate for this response, including setting the appropriate character encoding. |
void |
setStream(OutputStream stream)
Set the output stream associated with this Response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected byte[] buffer
protected int bufferCount
protected boolean committed
protected int contentCount
protected int contentLength
protected String contentType
protected String encoding
protected boolean included
protected Locale locale
protected OutputStream output
protected javax.servlet.ServletOutputStream stream
getOutputStream()
, if any.
protected PrintWriter writer
getWriter()
, if any.
protected boolean error
Constructor Detail |
---|
public ServletResponseImpl()
Method Detail |
---|
public int getContentCount()
public OutputStream getStream()
public void setStream(OutputStream stream)
stream
- The new output streampublic javax.servlet.ServletOutputStream createOutputStream() throws IOException
IOException
- if an input/output error occurspublic void finishResponse() throws IOException
IOException
- if an input/output error occurspublic int getContentLength()
public String getContentType()
null
if no content type was set.
public void flushBuffer() throws IOException
flushBuffer
in interface javax.servlet.ServletResponse
IOException
- if an input/output error occurspublic int getBufferSize()
getBufferSize
in interface javax.servlet.ServletResponse
public String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletResponse
public javax.servlet.ServletOutputStream getOutputStream() throws IOException
getOutputStream
in interface javax.servlet.ServletResponse
IllegalStateException
- if getWriter
has
already been called for this response
IOException
- if an input/output error occurspublic Locale getLocale()
getLocale
in interface javax.servlet.ServletResponse
public PrintWriter getWriter() throws IOException
getWriter
in interface javax.servlet.ServletResponse
IllegalStateException
- if getOutputStream
has
already been called for this response
IOException
- if an input/output error occurspublic boolean isCommitted()
isCommitted
in interface javax.servlet.ServletResponse
public void reset()
reset
in interface javax.servlet.ServletResponse
IllegalStateException
- if this response has already
been committedpublic void resetBuffer()
resetBuffer
in interface javax.servlet.ServletResponse
IllegalStateException
- if the response has already
been committedpublic void setBufferSize(int size)
setBufferSize
in interface javax.servlet.ServletResponse
size
- The new buffer size
IllegalStateException
- if this method is called after
output has been committed for this responsepublic void setContentLength(int length)
setContentLength
in interface javax.servlet.ServletResponse
length
- The new content lengthpublic void setContentType(String type)
setContentType
in interface javax.servlet.ServletResponse
type
- The new content typepublic void setLocale(Locale locale)
setLocale
in interface javax.servlet.ServletResponse
locale
- The new locale
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |