@NotThreadSafe public class StatusAwareHttpResponseWrapper extends javax.servlet.http.HttpServletResponseWrapper
HttpServletResponseWrapper that tracks the used status
codes as well as the set HTTP response headers.SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, 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 and Description |
|---|
StatusAwareHttpResponseWrapper(javax.servlet.http.HttpServletResponse aHttpResponse) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDateHeader(String sName,
long nMillis) |
void |
addHeader(String sName,
String sValue) |
void |
addIntHeader(String sName,
int nValue) |
int |
getStatusCode() |
com.helger.commons.http.HttpHeaderMap |
headerMap() |
void |
reset() |
void |
sendError(int sc) |
void |
sendError(int sc,
String msg) |
void |
sendRedirect(String sLocation) |
void |
setContentLength(int nLength) |
void |
setContentType(String sContentType) |
void |
setDateHeader(String sName,
long nMillis) |
void |
setHeader(String sName,
String sValue) |
void |
setIntHeader(String sName,
int nValue) |
void |
setStatus(int sc) |
void |
setStatus(int sc,
String sm)
Deprecated.
|
static StatusAwareHttpResponseWrapper |
wrap(javax.servlet.http.HttpServletResponse aHttpResponse) |
addCookie, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getHeader, getHeaderNames, getHeaders, getStatusflushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getResponse, getWriter, isCommitted, isWrapperFor, isWrapperFor, resetBuffer, setBufferSize, setCharacterEncoding, setContentLengthLong, setLocale, setResponsepublic StatusAwareHttpResponseWrapper(@Nonnull javax.servlet.http.HttpServletResponse aHttpResponse)
@OverridingMethodsMustInvokeSuper public void setStatus(int sc)
setStatus in interface javax.servlet.http.HttpServletResponsesetStatus in class javax.servlet.http.HttpServletResponseWrapper@Deprecated @OverridingMethodsMustInvokeSuper public void setStatus(int sc, String sm)
setStatus in interface javax.servlet.http.HttpServletResponsesetStatus in class javax.servlet.http.HttpServletResponseWrapper@OverridingMethodsMustInvokeSuper public void sendError(int sc, String msg) throws IOException
sendError in interface javax.servlet.http.HttpServletResponsesendError in class javax.servlet.http.HttpServletResponseWrapperIOException@OverridingMethodsMustInvokeSuper public void sendError(int sc) throws IOException
sendError in interface javax.servlet.http.HttpServletResponsesendError in class javax.servlet.http.HttpServletResponseWrapperIOException@OverridingMethodsMustInvokeSuper public void sendRedirect(String sLocation) throws IOException
sendRedirect in interface javax.servlet.http.HttpServletResponsesendRedirect in class javax.servlet.http.HttpServletResponseWrapperIOExceptionpublic final int getStatusCode()
public void reset()
reset in interface javax.servlet.ServletResponsereset in class javax.servlet.ServletResponseWrapperpublic void setContentLength(int nLength)
setContentLength in interface javax.servlet.ServletResponsesetContentLength in class javax.servlet.ServletResponseWrapperpublic void setContentType(@Nonnull String sContentType)
setContentType in interface javax.servlet.ServletResponsesetContentType in class javax.servlet.ServletResponseWrapperpublic void setDateHeader(@Nonnull @Nonempty String sName, long nMillis)
setDateHeader in interface javax.servlet.http.HttpServletResponsesetDateHeader in class javax.servlet.http.HttpServletResponseWrapperpublic void addDateHeader(@Nonnull @Nonempty String sName, long nMillis)
addDateHeader in interface javax.servlet.http.HttpServletResponseaddDateHeader in class javax.servlet.http.HttpServletResponseWrapperpublic void setHeader(@Nonnull @Nonempty String sName, @Nonnull String sValue)
setHeader in interface javax.servlet.http.HttpServletResponsesetHeader in class javax.servlet.http.HttpServletResponseWrapperpublic void addHeader(@Nonnull @Nonempty String sName, @Nonnull String sValue)
addHeader in interface javax.servlet.http.HttpServletResponseaddHeader in class javax.servlet.http.HttpServletResponseWrapperpublic void setIntHeader(@Nonnull @Nonempty String sName, int nValue)
setIntHeader in interface javax.servlet.http.HttpServletResponsesetIntHeader in class javax.servlet.http.HttpServletResponseWrapperpublic void addIntHeader(@Nonnull @Nonempty String sName, int nValue)
addIntHeader in interface javax.servlet.http.HttpServletResponseaddIntHeader in class javax.servlet.http.HttpServletResponseWrapper@Nonnull @ReturnsMutableObject public com.helger.commons.http.HttpHeaderMap headerMap()
@Nonnull public static StatusAwareHttpResponseWrapper wrap(@Nonnull javax.servlet.http.HttpServletResponse aHttpResponse)
Copyright © 2016–2019 Philip Helger. All rights reserved.