|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.ServletResponseWrapper javax.servlet.http.HttpServletResponseWrapper org.apache.click.extras.filter.CompressionServletResponseWrapper
public class CompressionServletResponseWrapper
Implementation of HttpServletResponseWrapper that works with the CompressionServletResponseStream implementation.
Note this Jakarta Tomcat examples Filter is packaged in Click Extras for convenience.
Field Summary | |
---|---|
protected String |
contentType
Content type. |
protected static String |
INFO
Descriptive information about this Response implementation. |
protected HttpServletRequest |
origRequest
The request with which this servlet is associated. |
protected HttpServletResponse |
origResponse
Original response. |
protected ServletOutputStream |
stream
The ServletOutputStream that has been returned by getOutputStream() , if any. |
protected int |
threshold
The threshold number to compress. |
protected PrintWriter |
writer
The PrintWriter that has been returned by getWriter() , if any. |
Constructor Summary | |
---|---|
CompressionServletResponseWrapper(HttpServletResponse response,
HttpServletRequest request)
Calls the parent constructor which creates a ServletResponse adaptor wrapping the given response object. |
Method Summary | |
---|---|
ServletOutputStream |
createOutputStream()
Create and return a ServletOutputStream to write the content associated with this Response. |
void |
finishResponse()
Finish a response. |
void |
flushBuffer()
Flush the buffer and commit this response. |
ServletOutputStream |
getOutputStream()
Return the servlet output stream associated with this Response. |
PrintWriter |
getWriter()
Return the writer associated with this Response. |
void |
setCompressionThreshold(int threshold)
Set threshold the compression threshold in bytes. |
void |
setContentLength(int length)
Set the content length. |
void |
setContentType(String contentType)
Set content type. |
void |
setHeader(String header,
String value)
Set the string value in the header. |
void |
setIntHeader(String header,
int value)
Set the int value in the header. |
Methods inherited from class javax.servlet.http.HttpServletResponseWrapper |
---|
addCookie, addDateHeader, addHeader, addIntHeader, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, sendError, sendError, sendRedirect, setDateHeader, setStatus, setStatus |
Methods inherited from class javax.servlet.ServletResponseWrapper |
---|
getBufferSize, getCharacterEncoding, getLocale, getResponse, isCommitted, reset, resetBuffer, setBufferSize, setLocale, setResponse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.ServletResponse |
---|
getBufferSize, getCharacterEncoding, getLocale, isCommitted, reset, resetBuffer, setBufferSize, setLocale |
Field Detail |
---|
protected HttpServletResponse origResponse
protected HttpServletRequest origRequest
protected static final String INFO
protected ServletOutputStream stream
getOutputStream()
, if any.
protected PrintWriter writer
getWriter()
, if any.
protected int threshold
protected String contentType
Constructor Detail |
---|
public CompressionServletResponseWrapper(HttpServletResponse response, HttpServletRequest request)
response
- the servlet response to wraprequest
- The associated requestMethod Detail |
---|
public void setContentType(String contentType)
setContentType
in interface ServletResponse
setContentType
in class ServletResponseWrapper
contentType
- the response content typepublic void setCompressionThreshold(int threshold)
threshold
- the compression threshold in bytespublic ServletOutputStream createOutputStream() throws IOException
IOException
- if an input/output error occurspublic void finishResponse()
public void flushBuffer() throws IOException
flushBuffer
in interface ServletResponse
flushBuffer
in class ServletResponseWrapper
IOException
- if an input/output error occurspublic ServletOutputStream getOutputStream() throws IOException
getOutputStream
in interface ServletResponse
getOutputStream
in class ServletResponseWrapper
IllegalStateException
- if getWriter
has
already been called for this response
IOException
- if an input/output error occurspublic PrintWriter getWriter() throws IOException
getWriter
in interface ServletResponse
getWriter
in class ServletResponseWrapper
IllegalStateException
- if getOutputStream
has
already been called for this response
IOException
- if an input/output error occurspublic void setContentLength(int length)
setContentLength
in interface ServletResponse
setContentLength
in class ServletResponseWrapper
length
- the content lengthpublic void setIntHeader(String header, int value)
setIntHeader
in interface HttpServletResponse
setIntHeader
in class HttpServletResponseWrapper
header
- the response headervalue
- the int valuepublic void setHeader(String header, String value)
setHeader
in interface HttpServletResponse
setHeader
in class HttpServletResponseWrapper
header
- the response headervalue
- the string value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |