Class RemoteCookie

  • All Implemented Interfaces:
    Serializable

    public class RemoteCookie
    extends Object
    implements Serializable
    Encapsulates a Cookie making it Serializable.
    Author:
    Steve Ferris steve.ferris@forgerock.com
    See Also:
    Serialized Form
    • Constructor Detail

      • RemoteCookie

        public RemoteCookie()
      • RemoteCookie

        public RemoteCookie​(jakarta.servlet.http.Cookie cookie)
        Creates a RemoteCookie based on the contents of the supplied Cookie.
        Parameters:
        cookie - The Cookie to be serialized
    • Method Detail

      • getCookie

        public jakarta.servlet.http.Cookie getCookie()
        Returns a Cookie representing the state of this serialized cookie
        Returns:
        Cookie representing original state of the Cookie
      • getComment

        public String getComment()
        Retrieves the cookie comment
        Returns:
        The comment of the cookie or null
      • getDomain

        public String getDomain()
        Retrieves the domain of the cookie
        Returns:
        The cookie domain if set
      • getMaxAge

        public int getMaxAge()
        Retrieves the cookies maximum age
        Returns:
        The cookies expiry or -1 if not set
      • getName

        public String getName()
        Retrieves the name of the cookie
        Returns:
        String representing the cookie name
      • getPath

        public String getPath()
        Retrieves the path of the cookie, if set
        Returns:
        The cookie path or null
      • getSecure

        public boolean getSecure()
        Is this cookie secure?
        Returns:
        true if the cookie is secure, false (default) otherwise
      • getValue

        public String getValue()
        Retrieves the value of the cookie
        Returns:
        A String representing the cookies value
      • getVersion

        public int getVersion()
        Retrieves the version of the cookie
        Returns:
        The version of the cookie, -1 if not set
      • setComment

        public void setComment​(String comment)
        Sets the cookies comment to supplied value. Updates underlying cookie implementation if present.
        Parameters:
        comment - The cookies new comment
      • setDomain

        public void setDomain​(String domain)
        Set the cookie domain to the supplied value. Updates the underlying cookie value if present.
        Parameters:
        domain - The cookie domain
      • setMaxAge

        public void setMaxAge​(int expiry)
        Sets the cookies maximum age (in seconds since the epoch). Updates the underlying cookie if present.
        Parameters:
        expiry - The cookies expiry
      • setPath

        public void setPath​(String uri)
        Sets the path of the cookie. Updates the underlying cookie if present.
        Parameters:
        uri - The new uri path of the cookie
      • setSecure

        public void setSecure​(boolean secure)
        Sets the secure flag of the cookie updating the underlying cookie representation if present.
        Parameters:
        secure - The new secure flag setting of the cookie
      • setValue

        public void setValue​(String newValue)
        Set the cookie to have a new value, updating the underlying cookie representatio if present.
        Parameters:
        newValue - The new value of the cookie
      • setVersion

        public void setVersion​(int version)
        Set the version of the cookie, updating the underlying representation if present.
        Parameters:
        version - the cookie version to set