public class CapturingResponseWrapper
extends javax.servlet.http.HttpServletResponseWrapper
THREAD SAFETY - One of these must be constructed on each HTTP request/response and hence only one thread may write to it at the one time. This suits the whole servlet engine idea,
Modifier and Type | Class and Description |
---|---|
static class |
CapturingResponseWrapper.HttpHeader
This class represent the HTTP headers that have been output to this ResponseWrapper
|
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, 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_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
Constructor and Description |
---|
CapturingResponseWrapper(javax.servlet.http.HttpServletResponse httpServletResponse,
int maxCaptureLen)
This will wrap the HttpServletResponse and capture up to maxCaptureLen of the response output.
|
Modifier and Type | Method and Description |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Overridden to capture cookie information.
|
void |
addDateHeader(String s,
long l)
Overridden to capture HTTP header information
|
void |
addHeader(String s,
String s1)
Overridden to capture HTTP header information
|
void |
addIntHeader(String s,
int i) |
byte[] |
getBytes()
This returns the bytes that have been captured on the ResponseWrapper.
|
List |
getCookieList()
This returns a list of all the
Cookie 's that have been set on this response |
List |
getHeaderList()
This returns a list of all the
CapturingResponseWrapper.HttpHeader 's that have been set on this response |
javax.servlet.ServletOutputStream |
getOutputStream() |
PrintWriter |
getWriter() |
void |
setDateHeader(String s,
long l)
Overridden to capture HTTP header information
|
void |
setHeader(String s,
String s1)
Overridden to capture HTTP header information
|
void |
setIntHeader(String s,
int i)
Overridden to capture HTTP header information
|
int |
size()
This returns the number of bytes that have been captured so far.
|
containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getHeader, getHeaderNames, getHeaders, getStatus, sendError, sendError, sendRedirect, setStatus, setStatus
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getResponse, isCommitted, isWrapperFor, isWrapperFor, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentLengthLong, setContentType, setLocale, setResponse
public CapturingResponseWrapper(javax.servlet.http.HttpServletResponse httpServletResponse, int maxCaptureLen)
httpServletResponse
- the servlet responsemaxCaptureLen
- the maximum number of bytes to capturepublic byte[] getBytes()
public int size()
public List getCookieList()
Cookie
's that have been set on this responseCookie
's that have been set on this responsepublic List getHeaderList()
CapturingResponseWrapper.HttpHeader
's that have been set on this responseCapturingResponseWrapper.HttpHeader
's that have been set on this responsepublic void addCookie(javax.servlet.http.Cookie cookie)
addCookie
in interface javax.servlet.http.HttpServletResponse
addCookie
in class javax.servlet.http.HttpServletResponseWrapper
public void setDateHeader(String s, long l)
setDateHeader
in interface javax.servlet.http.HttpServletResponse
setDateHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void addDateHeader(String s, long l)
addDateHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void setHeader(String s, String s1)
setHeader
in interface javax.servlet.http.HttpServletResponse
setHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void addHeader(String s, String s1)
addHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void setIntHeader(String s, int i)
setIntHeader
in interface javax.servlet.http.HttpServletResponse
setIntHeader
in class javax.servlet.http.HttpServletResponseWrapper
public void addIntHeader(String s, int i)
addIntHeader
in class javax.servlet.http.HttpServletResponseWrapper
public PrintWriter getWriter() throws IOException
getWriter
in interface javax.servlet.ServletResponse
getWriter
in class javax.servlet.ServletResponseWrapper
IOException
public javax.servlet.ServletOutputStream getOutputStream() throws IOException
getOutputStream
in interface javax.servlet.ServletResponse
getOutputStream
in class javax.servlet.ServletResponseWrapper
IOException
Copyright © 2002-2021 Atlassian. All Rights Reserved.