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(String name, long date)
      Add the date header.
      Parameters:
      name - the name.
      date - the date.
    • addHeader

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

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

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

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

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

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

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

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

      Collection<String> getHeaderNames()
      Returns the header names.
      Returns:
      the header names
    • getHeaders

      Collection<String> getHeaders(String name)
      Returns the headers.
      Parameters:
      name - the name.
      Returns:
      the headers
    • getStatus

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

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

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

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

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

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

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

      void setIntHeader(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, String message)
      Deprecated.
      Set the status.
      Parameters:
      status - the status.
      message - the message.
    • setTrailerFields

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