Class StatusAwareHttpResponseWrapper

  • All Implemented Interfaces:
    jakarta.servlet.http.HttpServletResponse, jakarta.servlet.ServletResponse
    Direct Known Subclasses:
    AbstractCompressedResponseWrapper

    @NotThreadSafe
    public class StatusAwareHttpResponseWrapper
    extends jakarta.servlet.http.HttpServletResponseWrapper
    A special HttpServletResponseWrapper that tracks the used status codes as well as the set HTTP response headers.
    Author:
    Philip Helger
    • Field Summary

      • Fields inherited from interface jakarta.servlet.http.HttpServletResponse

        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 Detail

      • StatusAwareHttpResponseWrapper

        public StatusAwareHttpResponseWrapper​(@Nonnull
                                              jakarta.servlet.http.HttpServletResponse aHttpResponse)
    • Method Detail

      • setStatus

        @OverridingMethodsMustInvokeSuper
        public void setStatus​(int sc)
        Specified by:
        setStatus in interface jakarta.servlet.http.HttpServletResponse
        Overrides:
        setStatus in class jakarta.servlet.http.HttpServletResponseWrapper
      • sendError

        @OverridingMethodsMustInvokeSuper
        public void sendError​(int sc)
                       throws IOException
        Specified by:
        sendError in interface jakarta.servlet.http.HttpServletResponse
        Overrides:
        sendError in class jakarta.servlet.http.HttpServletResponseWrapper
        Throws:
        IOException
      • getStatusCode

        public final int getStatusCode()
      • reset

        public void reset()
        Specified by:
        reset in interface jakarta.servlet.ServletResponse
        Overrides:
        reset in class jakarta.servlet.ServletResponseWrapper
      • setContentLength

        public void setContentLength​(int nLength)
        Specified by:
        setContentLength in interface jakarta.servlet.ServletResponse
        Overrides:
        setContentLength in class jakarta.servlet.ServletResponseWrapper
      • setContentType

        public void setContentType​(@Nonnull
                                   String sContentType)
        Specified by:
        setContentType in interface jakarta.servlet.ServletResponse
        Overrides:
        setContentType in class jakarta.servlet.ServletResponseWrapper
      • setDateHeader

        public void setDateHeader​(@Nonnull @Nonempty
                                  String sName,
                                  long nMillis)
        Specified by:
        setDateHeader in interface jakarta.servlet.http.HttpServletResponse
        Overrides:
        setDateHeader in class jakarta.servlet.http.HttpServletResponseWrapper
      • addDateHeader

        public void addDateHeader​(@Nonnull @Nonempty
                                  String sName,
                                  long nMillis)
        Specified by:
        addDateHeader in interface jakarta.servlet.http.HttpServletResponse
        Overrides:
        addDateHeader in class jakarta.servlet.http.HttpServletResponseWrapper
      • setHeader

        public void setHeader​(@Nonnull @Nonempty
                              String sName,
                              @Nonnull
                              String sValue)
        Specified by:
        setHeader in interface jakarta.servlet.http.HttpServletResponse
        Overrides:
        setHeader in class jakarta.servlet.http.HttpServletResponseWrapper
      • addHeader

        public void addHeader​(@Nonnull @Nonempty
                              String sName,
                              @Nonnull
                              String sValue)
        Specified by:
        addHeader in interface jakarta.servlet.http.HttpServletResponse
        Overrides:
        addHeader in class jakarta.servlet.http.HttpServletResponseWrapper
      • setIntHeader

        public void setIntHeader​(@Nonnull @Nonempty
                                 String sName,
                                 int nValue)
        Specified by:
        setIntHeader in interface jakarta.servlet.http.HttpServletResponse
        Overrides:
        setIntHeader in class jakarta.servlet.http.HttpServletResponseWrapper
      • addIntHeader

        public void addIntHeader​(@Nonnull @Nonempty
                                 String sName,
                                 int nValue)
        Specified by:
        addIntHeader in interface jakarta.servlet.http.HttpServletResponse
        Overrides:
        addIntHeader in class jakarta.servlet.http.HttpServletResponseWrapper
      • headerMap

        @Nonnull
        @ReturnsMutableObject
        public com.helger.commons.http.HttpHeaderMap headerMap()