Class UnbluCookie

java.lang.Object
com.unblu.sdk.core.configuration.UnbluCookie

public class UnbluCookie extends Object
Cookie representation for the Unblu sdk

used together with the UnbluClientConfiguration.Builder.setCustomCookies(Set) of the configuration

  • Constructor Details

    • UnbluCookie

      public UnbluCookie(@NonNull HttpCookie cookie)
      Constructs an UnbluCookie object from a HttpCookie object.
      The cookie's Expires attribute is calculated from its Max-Age attribute. Set Max-Age to -1 to ensure the cookie never expires.
      Parameters:
      cookie - The HttpCookie object from which to construct the UnbluCookie
    • UnbluCookie

      public UnbluCookie(@NonNull String key, @NonNull String value, @Nullable Date expires)
      Constructs an UnbluCookie object from the parameters provided
      Parameters:
      key - The cookie's name
      value - The cookie's value
      expires - The cookie's Expires attribute
    • UnbluCookie

      public UnbluCookie(@NonNull String key, @NonNull String value)
      Constructs an UnbluCookie object from the parameters provided.
      Cookies created with this constructor never expire.
      Parameters:
      key - The cookie's name
      value - The cookie value
  • Method Details

    • getKey

      @NonNull public String getKey()
      Returns:
      The name of the cookie
    • getValue

      @Nullable public String getValue()
      Returns:
      The value of the cookie
    • getExpires

      @Nullable public Date getExpires()
      Returns:
      The value of the cookie's Expires attribute
    • from

      public static Set<UnbluCookie> from(@NonNull Map<String,String> cookies)
      Creates a Set<UnbluCookie> from a Map<String, String>.
      Cookies created with this constructor never expire.
      Parameters:
      cookies - The custom cookie Map<key,value>
      Returns:
      Set
    • from

      public static Set<UnbluCookie> from(@NonNull List<HttpCookie> cookies)
      Creates a Set<UnbluCookie> from a Set<java.net.HttpCookie>.
      The constructor calculates each cookie's Expires attribute from its Max-Age attribute. Set Max-Age to -1 to ensure the cookie never expires.
      Parameters:
      cookies - The HttpCookie List<HttpCookie>
      Returns:
      Set
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object