Interface SetCookie

All Superinterfaces:
Cookie
All Known Implementing Classes:
BasicClientCookie

public interface SetCookie extends Cookie
This interface represents a Set-Cookie response header sent by the origin server to the HTTP agent in order to maintain a conversational state.
Since:
4.0
  • Method Details

    • setValue

      void setValue(String value)
    • setExpiryDate

      @Deprecated void setExpiryDate(Date expiryDate)
      Deprecated.
      Sets expiration date.

      Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.

      Parameters:
      expiryDate - the Date after which this cookie is no longer valid.
      See Also:
    • setExpiryDate

      default void setExpiryDate(Instant expiryDate)
      Sets expiration date.

      Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.

      Parameters:
      expiryDate - the Instant after which this cookie is no longer valid.
      Since:
      5.2
      See Also:
    • setDomain

      void setDomain(String domain)
      Sets the domain attribute.
      Parameters:
      domain - The value of the domain attribute
      See Also:
    • setPath

      void setPath(String path)
      Sets the path attribute.
      Parameters:
      path - The value of the path attribute
      See Also:
    • setSecure

      void setSecure(boolean secure)
      Sets the secure attribute of the cookie.

      When true the cookie should only be sent using a secure protocol (https). This should only be set when the cookie's originating server used a secure protocol to set the cookie's value.

      Parameters:
      secure - The value of the secure attribute
      See Also:
    • setHttpOnly

      default void setHttpOnly(boolean httpOnly)
      Marks or unmarks this Cookie as httpOnly.
      Parameters:
      httpOnly - true if this cookie is to be marked as httpOnly, false otherwise
      Since:
      5.2