Interface ServerResponseHeaders

All Superinterfaces:
ClientResponseHeaders, Headers, Iterable<Header>, WritableHeaders<ServerResponseHeaders>

public interface ServerResponseHeaders extends ClientResponseHeaders, WritableHeaders<ServerResponseHeaders>
Mutable headers of a server response.
  • Method Details

    • create

      static ServerResponseHeaders create()
      Create a new instance of mutable server response headers.
      Returns:
      new server response headers
    • create

      static ServerResponseHeaders create(Headers existing)
      Create a new instance of mutable server response headers.
      Parameters:
      existing - headers to add to these response headers
      Returns:
      new server response headers
    • addAcceptPatches

      default ServerResponseHeaders addAcceptPatches(MediaType... acceptableMediaTypes)
      Adds one or more acceptedTypes path document formats (header HeaderNames.ACCEPT_PATCH).
      Parameters:
      acceptableMediaTypes - media types to add.
      Returns:
      this instance
    • addCookie

      ServerResponseHeaders addCookie(SetCookie cookie)
      Adds Set-Cookie header specified in RFC6265.
      Parameters:
      cookie - a cookie definition
      Returns:
      this instance
    • addCookie

      default ServerResponseHeaders addCookie(String name, String value, Duration maxAge)
      Adds Set-Cookie header based on RFC6265 with Max-Age parameter.
      Parameters:
      name - name of the cookie
      value - value of the cookie
      maxAge - Max-Age cookie parameter
      Returns:
      this instance
    • addCookie

      default ServerResponseHeaders addCookie(String name, String value)
      Adds Set-Cookie header based on RFC2616.
      Parameters:
      name - name of the cookie
      value - value of the cookie
      Returns:
      this instance
    • clearCookie

      ServerResponseHeaders clearCookie(String name)
      Clears a cookie by adding a Set-Cookie header with an expiration date in the past.
      Parameters:
      name - name of the cookie.
      Returns:
      this instance
    • lastModified

      default ServerResponseHeaders lastModified(Instant modified)
      Sets the value of HeaderNames.LAST_MODIFIED header.

      The last modified date for the requested object

      Parameters:
      modified - Last modified date/time.
      Returns:
      this instance
    • lastModified

      default ServerResponseHeaders lastModified(ZonedDateTime modified)
      Sets the value of HeaderNames.LAST_MODIFIED header.

      The last modified date for the requested object

      Parameters:
      modified - Last modified date/time.
      Returns:
      this instance
    • location

      default ServerResponseHeaders location(URI location)
      Sets the value of HeaderNames.LOCATION header.

      Used in redirection, or when a new resource has been created.

      Parameters:
      location - Location header value.
      Returns:
      updated headers
    • expires

      default ServerResponseHeaders expires(ZonedDateTime dateTime)
      Sets the value of HeaderNames.EXPIRES header.

      The date/time after which the response is considered stale.

      Parameters:
      dateTime - Expires date/time.
      Returns:
      updated headers
    • expires

      default ServerResponseHeaders expires(Instant dateTime)
      Sets the value of HeaderNames.EXPIRES header.

      The date/time after which the response is considered stale.

      Parameters:
      dateTime - Expires date/time.
      Returns:
      updated headers