|
||||||||||
| 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
|
+--com.lowagie.servlets.BufferedResponse
Wraps an HttpServletResponse instance, filtering any attempt to write or flush its output. The data written to the response is store in a memory buffer.
| Nested Class Summary | |
private static class |
BufferedResponse.ByteArrayServletStream
Implements a ServletOutputStream that writes to a memory buffer. |
| Field Summary | |
private String |
declaredContentType
|
private int |
declaredLength
|
private boolean |
isModified
|
private BufferedResponse.ByteArrayServletStream |
out
|
private PrintWriter |
wOut
|
| Fields inherited from class javax.servlet.ServletResponseWrapper |
|
| Fields inherited from interface javax.servlet.http.HttpServletResponse |
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY |
| Constructor Summary | |
BufferedResponse(javax.servlet.http.HttpServletResponse response)
Constructs a new BufferedResponse, wrapping the response passed. |
|
| Method Summary | |
void |
flushBuffer()
Filters calls to flushBuffer() so that no data is written to the response before executing the output filter. |
InputStream |
getData()
Returns a InputStream with the data currently stored in the memory buffer.. |
String |
getDeclaredContentType()
Returns the content type declared by the called resource. |
int |
getDeclaredLength()
Returns the content length declared by the called resource. |
javax.servlet.ServletOutputStream |
getOutputStream()
Returns a OutputStream to the memory buffer. |
PrintWriter |
getWriter()
Returns a PrintWriter to the memory buffer. |
boolean |
isModified()
Says if the resource called has been modified or not. |
void |
setContentLength(int length)
Does not let the content length be set, but stores it in a variable in case it is needed later. |
void |
setContentType(String type)
Does not let the content type be set, but stores it in a variable in case it is needed later. |
void |
setStatus(int sc)
If the status set if SC_NOT_MODIFIED, sets a flag so that the output filter knows that the buffer may be empty. |
| Methods inherited from class javax.servlet.http.HttpServletResponseWrapper |
addCookie, addDateHeader, addHeader, addIntHeader, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, sendError, sendError, sendRedirect, setDateHeader, setHeader, setIntHeader, 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 |
private BufferedResponse.ByteArrayServletStream out
private PrintWriter wOut
private int declaredLength
private boolean isModified
private String declaredContentType
| Constructor Detail |
public BufferedResponse(javax.servlet.http.HttpServletResponse response)
throws IOException
Constructs a new BufferedResponse, wrapping the response passed.
response - The original response from the filter chain..| Method Detail |
public javax.servlet.ServletOutputStream getOutputStream()
throws IOException
Returns a OutputStream to the memory buffer.
getOutputStream in interface javax.servlet.ServletResponsegetOutputStream in class javax.servlet.ServletResponseWrapperIOException
public PrintWriter getWriter()
throws IOException
Returns a PrintWriter to the memory buffer.
getWriter in interface javax.servlet.ServletResponsegetWriter in class javax.servlet.ServletResponseWrapperIOException
public InputStream getData()
throws IOException
Returns a InputStream with the data currently stored in the memory buffer..
IOExceptionpublic void setContentLength(int length)
Does not let the content length be set, but stores it in a variable in case it is needed later.
setContentLength in interface javax.servlet.ServletResponsesetContentLength in class javax.servlet.ServletResponseWrapperpublic int getDeclaredLength()
Returns the content length declared by the called resource.
public void setContentType(String type)
Does not let the content type be set, but stores it in a variable in case it is needed later.
setContentType in interface javax.servlet.ServletResponsesetContentType in class javax.servlet.ServletResponseWrapperpublic String getDeclaredContentType()
public void setStatus(int sc)
If the status set if SC_NOT_MODIFIED, sets a flag so that the output filter knows that the buffer may be empty. This is to prevent errors when a static resource is wrapped by the filter and the containers returns an empty buffer if the resource has not been modified.
setStatus in interface javax.servlet.http.HttpServletResponsesetStatus in class javax.servlet.http.HttpServletResponseWrapperpublic boolean isModified()
public void flushBuffer()
throws IOException
flushBuffer in interface javax.servlet.ServletResponseflushBuffer in class javax.servlet.ServletResponseWrapperIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||