Interface HttpServletResponse

All Superinterfaces:
ServletResponse
All Known Subinterfaces:
WebApplicationResponse
All Known Implementing Classes:
DefaultWebApplicationResponse, EmbeddedResponse, HttpServletResponseWrapper, HttpWebApplicationResponse, NanoResponse

public interface HttpServletResponse
extends ServletResponse
The HttpServletResponse API.
Author:
Manfred Riem ([email protected])
  • Field Details

    • SC_CONTINUE

      static final int SC_CONTINUE
      Defines the 100 status code.
      See Also:
      Constant Field Values
    • SC_SWITCHING_PROTOCOLS

      static final int SC_SWITCHING_PROTOCOLS
      Defines the 101 status code.
      See Also:
      Constant Field Values
    • SC_OK

      static final int SC_OK
      Defines the 200 status code.
      See Also:
      Constant Field Values
    • SC_CREATED

      static final int SC_CREATED
      Defines the 201 status code.
      See Also:
      Constant Field Values
    • SC_ACCEPTED

      static final int SC_ACCEPTED
      Defines the 202 status code.
      See Also:
      Constant Field Values
    • SC_NON_AUTHORITATIVE_INFORMATION

      static final int SC_NON_AUTHORITATIVE_INFORMATION
      Defines the 203 status code.
      See Also:
      Constant Field Values
    • SC_NO_CONTENT

      static final int SC_NO_CONTENT
      Defines the 204 status code.
      See Also:
      Constant Field Values
    • SC_RESET_CONTENT

      static final int SC_RESET_CONTENT
      Defines the 205 status code.
      See Also:
      Constant Field Values
    • SC_PARTIAL_CONTENT

      static final int SC_PARTIAL_CONTENT
      Defines the 206 status code.
      See Also:
      Constant Field Values
    • SC_MULTIPLE_CHOICES

      static final int SC_MULTIPLE_CHOICES
      Defines the 300 status code.
      See Also:
      Constant Field Values
    • SC_MOVED_PERMANENTLY

      static final int SC_MOVED_PERMANENTLY
      Defines the 301 status code.
      See Also:
      Constant Field Values
    • SC_MOVED_TEMPORARILY

      static final int SC_MOVED_TEMPORARILY
      Defines the 302 status code.
      See Also:
      Constant Field Values
    • SC_FOUND

      static final int SC_FOUND
      Defines the 302 status code (recommended variant).
      See Also:
      Constant Field Values
    • SC_SEE_OTHER

      static final int SC_SEE_OTHER
      Defines the 303 status code.
      See Also:
      Constant Field Values
    • SC_NOT_MODIFIED

      static final int SC_NOT_MODIFIED
      Defines the 305 status code.
      See Also:
      Constant Field Values
    • SC_USE_PROXY

      static final int SC_USE_PROXY
      Defines the 305 status code.
      See Also:
      Constant Field Values
    • SC_TEMPORARY_REDIRECT

      static final int SC_TEMPORARY_REDIRECT
      Defines the 307 status code.
      See Also:
      Constant Field Values
    • SC_BAD_REQUEST

      static final int SC_BAD_REQUEST
      Defines the 400 status code.
      See Also:
      Constant Field Values
    • SC_UNAUTHORIZED

      static final int SC_UNAUTHORIZED
      Defines the 401 status code.
      See Also:
      Constant Field Values
    • SC_PAYMENT_REQUIRED

      static final int SC_PAYMENT_REQUIRED
      Defines the 402 status code.
      See Also:
      Constant Field Values
    • SC_FORBIDDEN

      static final int SC_FORBIDDEN
      Defines the 403 status code.
      See Also:
      Constant Field Values
    • SC_NOT_FOUND

      static final int SC_NOT_FOUND
      Defines the 404 status code.
      See Also:
      Constant Field Values
    • SC_METHOD_NOT_ALLOWED

      static final int SC_METHOD_NOT_ALLOWED
      Defines the 405 status code.
      See Also:
      Constant Field Values
    • SC_NOT_ACCEPTABLE

      static final int SC_NOT_ACCEPTABLE
      Defines the 406 status code.
      See Also:
      Constant Field Values
    • SC_PROXY_AUTHENTICATION_REQUIRED

      static final int SC_PROXY_AUTHENTICATION_REQUIRED
      Defines the 407 status code.
      See Also:
      Constant Field Values
    • SC_REQUEST_TIMEOUT

      static final int SC_REQUEST_TIMEOUT
      Defines the 408 status code.
      See Also:
      Constant Field Values
    • SC_CONFLICT

      static final int SC_CONFLICT
      Defines the 409 status code.
      See Also:
      Constant Field Values
    • SC_GONE

      static final int SC_GONE
      Defines the 410 status code.
      See Also:
      Constant Field Values
    • SC_LENGTH_REQUIRED

      static final int SC_LENGTH_REQUIRED
      Defines the 411 status code.
      See Also:
      Constant Field Values
    • SC_PRECONDITION_FAILED

      static final int SC_PRECONDITION_FAILED
      Defines the 412 status code.
      See Also:
      Constant Field Values
    • SC_REQUEST_ENTITY_TOO_LARGE

      static final int SC_REQUEST_ENTITY_TOO_LARGE
      Defines the 413 status code.
      See Also:
      Constant Field Values
    • SC_REQUEST_URI_TOO_LONG

      static final int SC_REQUEST_URI_TOO_LONG
      Defines the 414 status code.
      See Also:
      Constant Field Values
    • SC_UNSUPPORTED_MEDIA_TYPE

      static final int SC_UNSUPPORTED_MEDIA_TYPE
      Defines the 415 status code.
      See Also:
      Constant Field Values
    • SC_REQUESTED_RANGE_NOT_SATISFIABLE

      static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE
      Defines the 416 status code.
      See Also:
      Constant Field Values
    • SC_EXPECTATION_FAILED

      static final int SC_EXPECTATION_FAILED
      Defines the 417 status code.
      See Also:
      Constant Field Values
    • SC_INTERNAL_SERVER_ERROR

      static final int SC_INTERNAL_SERVER_ERROR
      Defines the 500 status code.
      See Also:
      Constant Field Values
    • SC_NOT_IMPLEMENTED

      static final int SC_NOT_IMPLEMENTED
      Defines the 501 status code.
      See Also:
      Constant Field Values
    • SC_BAD_GATEWAY

      static final int SC_BAD_GATEWAY
      Defines the 502 status code.
      See Also:
      Constant Field Values
    • SC_SERVICE_UNAVAILABLE

      static final int SC_SERVICE_UNAVAILABLE
      Defines the 503 status code.
      See Also:
      Constant Field Values
    • SC_GATEWAY_TIMEOUT

      static final int SC_GATEWAY_TIMEOUT
      Defines the 504 status code.
      See Also:
      Constant Field Values
    • SC_HTTP_VERSION_NOT_SUPPORTED

      static final int SC_HTTP_VERSION_NOT_SUPPORTED
      Defines the 505 status code.
      See Also:
      Constant Field Values
  • Method Details

    • addCookie

      void addCookie​(Cookie cookie)
      Adds the cookie.
      Parameters:
      cookie - the cookie.
    • addDateHeader

      void addDateHeader​(java.lang.String name, long date)
      Add the date header.
      Parameters:
      name - the name.
      date - the date.
    • addHeader

      void addHeader​(java.lang.String name, java.lang.String value)
      Add the header.
      Parameters:
      name - the name.
      value - the value.
    • addIntHeader

      void addIntHeader​(java.lang.String name, int value)
      Add the intheader.
      Parameters:
      name - the name.
      value - the value.
    • containsHeader

      boolean containsHeader​(java.lang.String name)
      Contains the header.
      Parameters:
      name - the name.
      Returns:
      true if it contains the given header, false otherwise.
    • encodeRedirectURL

      java.lang.String encodeRedirectURL​(java.lang.String url)
      Encode the redirect URL.
      Parameters:
      url - the redirect URL.
      Returns:
      the encoded redirect URL.
    • encodeRedirectUrl

      @Deprecated java.lang.String encodeRedirectUrl​(java.lang.String url)
      Deprecated.
      Encode the redirect URL.
      Parameters:
      url - the redirect URL.
      Returns:
      the encoded redirect URL.
    • encodeURL

      java.lang.String encodeURL​(java.lang.String url)
      Encode the URL.
      Parameters:
      url - the URL.
      Returns:
      the encoded URL.
    • encodeUrl

      @Deprecated java.lang.String encodeUrl​(java.lang.String url)
      Deprecated.
      Encode the URL.
      Parameters:
      url - the URL.
      Returns:
      the encoded URL.
    • getHeader

      java.lang.String getHeader​(java.lang.String name)
      Get the header.
      Parameters:
      name - the name.
      Returns:
      the value, or null if not found.
    • getHeaderNames

      java.util.Collection<java.lang.String> getHeaderNames()
      Get the header names.
      Returns:
      the header names.
    • getHeaders

      java.util.Collection<java.lang.String> getHeaders​(java.lang.String name)
      Get the headers.
      Parameters:
      name - the name.
      Returns:
      the headers.
    • getStatus

      int getStatus()
      Get the status.
      Returns:
      the status.
    • getTrailerFields

      default java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.String>> getTrailerFields()
      Get the supplier of trailer fields.
      Returns:
      the supplier of trailer fields.
    • sendError

      void sendError​(int status, java.lang.String message) throws java.io.IOException
      Send the error.
      Parameters:
      status - the status code.
      message - the message.
      Throws:
      java.io.IOException - when an I/O error occurs.
    • sendError

      void sendError​(int status) throws java.io.IOException
      Sends the error.
      Parameters:
      status - the status code.
      Throws:
      java.io.IOException - when an I/O error occurs.
    • sendRedirect

      void sendRedirect​(java.lang.String location) throws java.io.IOException
      Send a redirect.
      Parameters:
      location - the location.
      Throws:
      java.io.IOException - when an I/O error occurs.
    • setDateHeader

      void setDateHeader​(java.lang.String name, long date)
      Set the date header.
      Parameters:
      name - the name.
      date - the date.
    • setHeader

      void setHeader​(java.lang.String name, java.lang.String value)
      Set the header.
      Parameters:
      name - the name.
      value - the value.
    • setIntHeader

      void setIntHeader​(java.lang.String name, int value)
      Set the int header.
      Parameters:
      name - the name.
      value - the value.
    • setStatus

      void setStatus​(int status)
      Set the status.
      Parameters:
      status - the status.
    • setStatus

      @Deprecated void setStatus​(int status, java.lang.String message)
      Deprecated.
      Set the status.
      Parameters:
      status - the status.
      message - the message.
    • setTrailerFields

      default void setTrailerFields​(java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.String>> supplier)
      Set the trailer fields supplier.
      Parameters:
      supplier - the trailer fields supplier.