Class DefaultCookie

    • Constructor Detail

      • DefaultCookie

        public DefaultCookie​(String name,
                             String value)
        Creates a new cookie with the specified name and value.
        Parameters:
        name - The cookie's name
        value - The cookie's value.
    • Method Detail

      • name

        public String name()
        Description copied from interface: Cookie
        Returns the name of this Cookie.
        Specified by:
        name in interface Cookie
        Returns:
        The name of this Cookie
      • value

        public String value()
        Description copied from interface: Cookie
        Returns the value of this Cookie.
        Specified by:
        value in interface Cookie
        Returns:
        The value of this Cookie
      • setValue

        public void setValue​(String value)
        Description copied from interface: Cookie
        Sets the value of this Cookie.
        Specified by:
        setValue in interface Cookie
        Parameters:
        value - The value to set
      • wrap

        public boolean wrap()
        Description copied from interface: Cookie
        Returns true if the raw value of this Cookie, was wrapped with double quotes in original Set-Cookie header.
        Specified by:
        wrap in interface Cookie
        Returns:
        If the value of this Cookie is to be wrapped
      • setWrap

        public void setWrap​(boolean wrap)
        Description copied from interface: Cookie
        Sets true if the value of this Cookie is to be wrapped with double quotes.
        Specified by:
        setWrap in interface Cookie
        Parameters:
        wrap - true if wrap
      • domain

        public String domain()
        Description copied from interface: Cookie
        Returns the domain of this Cookie.
        Specified by:
        domain in interface Cookie
        Returns:
        The domain of this Cookie
      • setDomain

        public void setDomain​(String domain)
        Description copied from interface: Cookie
        Sets the domain of this Cookie.
        Specified by:
        setDomain in interface Cookie
        Parameters:
        domain - The domain to use
      • path

        public String path()
        Description copied from interface: Cookie
        Returns the path of this Cookie.
        Specified by:
        path in interface Cookie
        Returns:
        The Cookie's path
      • setPath

        public void setPath​(String path)
        Description copied from interface: Cookie
        Sets the path of this Cookie.
        Specified by:
        setPath in interface Cookie
        Parameters:
        path - The path to use for this Cookie
      • maxAge

        public int maxAge()
        Description copied from interface: Cookie
        Returns the maximum age of this Cookie in seconds or Integer.MIN_VALUE if unspecified
        Specified by:
        maxAge in interface Cookie
        Returns:
        The maximum age of this Cookie
      • setMaxAge

        public void setMaxAge​(int maxAge)
        Description copied from interface: Cookie
        Sets the maximum age of this Cookie in seconds. If an age of 0 is specified, this Cookie will be automatically removed by browser because it will expire immediately. If Integer.MIN_VALUE is specified, this Cookie will be removed when the browser is closed.
        Specified by:
        setMaxAge in interface Cookie
        Parameters:
        maxAge - The maximum age of this Cookie in seconds
      • isSecure

        public boolean isSecure()
        Description copied from interface: Cookie
        Checks to see if this Cookie is secure
        Specified by:
        isSecure in interface Cookie
        Returns:
        True if this Cookie is secure, otherwise false
      • setSecure

        public void setSecure​(boolean secure)
        Description copied from interface: Cookie
        Sets the security getStatus of this Cookie
        Specified by:
        setSecure in interface Cookie
        Parameters:
        secure - True if this Cookie is to be secure, otherwise false
      • sameSite

        public String sameSite()
        Description copied from interface: Cookie
        Returns the SameSite attribute of this cookie as a String
        Specified by:
        sameSite in interface Cookie
        Returns:
        The SameSite attribute of the cookie
      • setSameSite

        public void setSameSite​(String sameSite)
      • isHttpOnly

        public boolean isHttpOnly()
        Description copied from interface: Cookie
        Checks to see if this Cookie can only be accessed via HTTP. If this returns true, the Cookie cannot be accessed through client side script - But only if the browser supports it. For more information, please look here
        Specified by:
        isHttpOnly in interface Cookie
        Returns:
        True if this Cookie is HTTP-only or false if it isn't
      • setHttpOnly

        public void setHttpOnly​(boolean httpOnly)
        Description copied from interface: Cookie
        Determines if this Cookie is HTTP only. If set to true, this Cookie cannot be accessed by a client side script. However, this works only if the browser supports it. For for information, please look here.
        Specified by:
        setHttpOnly in interface Cookie
        Parameters:
        httpOnly - True if the Cookie is HTTP only, otherwise false.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • validateValue

        @Deprecated
        protected String validateValue​(String name,
                                       String value)
        Deprecated.
        CookieUtil is package private, will be removed once old Cookie API is dropped
        Validate a cookie attribute value, throws a IllegalArgumentException otherwise. Only intended to be used by DefaultCookie.
        Parameters:
        name - attribute name
        value - attribute value
        Returns:
        the trimmed, validated attribute value