|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.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 request| Method Detail |
|---|
public void setContentType(String contentType)
setContentType in interface ServletResponsesetContentType in class ServletResponseWrappercontentType - the response content typepublic void setCompressionThreshold(int threshold)
threshold - the compression threshold in bytes
public ServletOutputStream createOutputStream()
throws IOException
IOException - if an input/output error occurspublic void finishResponse()
public void flushBuffer()
throws IOException
flushBuffer in interface ServletResponseflushBuffer in class ServletResponseWrapperIOException - if an input/output error occurs
public ServletOutputStream getOutputStream()
throws IOException
getOutputStream in interface ServletResponsegetOutputStream in class ServletResponseWrapperIllegalStateException - if getWriter has
already been called for this response
IOException - if an input/output error occurs
public PrintWriter getWriter()
throws IOException
getWriter in interface ServletResponsegetWriter in class ServletResponseWrapperIllegalStateException - if getOutputStream has
already been called for this response
IOException - if an input/output error occurspublic void setContentLength(int length)
setContentLength in interface ServletResponsesetContentLength in class ServletResponseWrapperlength - the content length
public void setIntHeader(String header,
int value)
setIntHeader in interface HttpServletResponsesetIntHeader in class HttpServletResponseWrapperheader - the response headervalue - the int value
public void setHeader(String header,
String value)
setHeader in interface HttpServletResponsesetHeader in class HttpServletResponseWrapperheader - the response headervalue - the string value
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||