Interface ResponseCookies


public interface ResponseCookies
A builder of response cookies.
Since:
2.1.0
  • Method Details

    • add

      Adds a standard, plain-text cookie to the response.

      To sign or encrypt the value of the cookie, use the add(StandardResponseCookie, ValueTransformation) method instead.

      Parameters:
      cookie - to add to the response
      Returns:
      this
    • add

      ResponseCookies add(StandardResponseCookie cookie, ValueTransformation valueTransformation)
      Adds a standard cookie to the response.
      Parameters:
      cookie - to add to the response
      valueTransformation - transformation to apply to the cookie value
      Returns:
      this
    • addEncrypted

      ResponseCookies addEncrypted(ResponseCookie cookie)
      Adds a cookie to the response, applying the ValueTransformation.ENCRYPT transformation to its value.
      Parameters:
      cookie - to add to the response after encrypting its value
      Returns:
      this
    • addSigned

      ResponseCookies addSigned(ResponseCookie cookie)
      Adds a cookie to the response, applying the ValueTransformation.SIGN transformation to its value.
      Parameters:
      cookie - to add to the response after signing its value
      Returns:
      this
    • remove

      default ResponseCookies remove(String name)
      Tell the client to remove the cookie with the given name (on the domain of the request).

      The path of the expired cookie sent to the client is set to "/". Use remove(String, String) to control which path the cookie should have.

      Parameters:
      name - of cookie to be removed
      Returns:
      this
    • remove

      default ResponseCookies remove(String name, String path)
      Tell the client to remove the cookie with the given name and path (on the domain of the request).
      Parameters:
      name - of cookie to be removed
      path - of the cookie
      Returns:
      this
    • remove

      ResponseCookies remove(String name, String path, @Nullable String domain)
      Tell the client to remove the cookie with the given name and path on a certain domain.
      Parameters:
      name - of cookie to be removed
      path - of the cookie
      domain - domain the cookie was set on (null means the the domain of the request should be used)
      Returns:
      this
      Since:
      4.2.0