Interface HttpResponseCookie

    • Field Detail

      • BROWSER_SESSION_MAX_AGE

        static final long BROWSER_SESSION_MAX_AGE
        Value of Max-Age indicating no age expire and should expire with the browser session.
        See Also:
        Constant Field Values
    • Method Detail

      • getName

        java.lang.String getName()
        Obtains the name.
        Returns:
        Name.
      • getValue

        java.lang.String getValue()
        Obtains the value.
        Returns:
        Value.
      • setValue

        HttpResponseCookie setValue​(java.lang.String value)
        Sets the value.
        Parameters:
        value - Value.
        Returns:
        this.
      • getExpires

        java.time.temporal.TemporalAccessor getExpires()
        Obtains the expire time.
        Returns:
        Expire time. May be null if no expire.
      • setExpires

        HttpResponseCookie setExpires​(java.time.temporal.TemporalAccessor expires)
        Sets the expire time.
        Parameters:
        expires - Expires time.
        Returns:
        this.
      • getMaxAge

        long getMaxAge()
        Obtains the maximum age in seconds.
        Returns:
        Maximum age in seconds. Will be BROWSER_SESSION_MAX_AGE if not specified.
      • setMaxAge

        HttpResponseCookie setMaxAge​(long maxAge)

        Sets the maximum age in seconds.

        As per RFC 6265 this overrides Expires.

        Parameters:
        maxAge - Maximum age in seconds.
        Returns:
        this.
      • getDomain

        java.lang.String getDomain()
        Obtains the domain.
        Returns:
        Domain. May be null.
      • setDomain

        HttpResponseCookie setDomain​(java.lang.String domain)
        Specifies the domain.
        Parameters:
        domain - Domain.
        Returns:
        this.
      • getPath

        java.lang.String getPath()
        Obtains the path.
        Returns:
        Path. May be null.
      • setPath

        HttpResponseCookie setPath​(java.lang.String path)
        Specifies the path.
        Parameters:
        path - Path.
        Returns:
        this.
      • isSecure

        boolean isSecure()

        Indicates if only communicated across secure a secure connection.

        Note that, as per RFC 6265, this does not guarantee the security of the cookie contents. Cookies, as per the specification, are inherently insecure (such as any information sent to the client).

        Returns:
        true to only communicate this Cookie across a secure connection.
      • setSecure

        HttpResponseCookie setSecure​(boolean isSecure)
        Flags whether the client is only to send the Cookie over a secure connection.
        Parameters:
        isSecure - true to request the client to only send this Cookie over a secure connection (assuming the client supports this).
        Returns:
        this.
      • isHttpOnly

        boolean isHttpOnly()
        Indicates if the Cookie is only sent over HTTP connection.
        Returns:
        true to only make this Cookie available in HTTP requests.
      • setHttpOnly

        HttpResponseCookie setHttpOnly​(boolean isHttpOnly)
        Indicates if only available over HTTP requests (and not, for example, made available to JavaScript in the browser).
        Parameters:
        isHttpOnly - true to request the client to only send this Cookie in HTTP requests, and not, for example, make available to JavaScript in the browser.
        Returns:
        this.
      • addExtension

        HttpResponseCookie addExtension​(java.lang.String extension)

        Allows adding an extension.

        The extensions are added as provided (separated by ';') to the end of the Set-Cookie HttpHeader.

        Parameters:
        extension - Extension.
        Returns:
        this.
      • getExtensions

        java.lang.String[] getExtensions()
        Obtains the extensions.
        Returns:
        Extensions.
      • clearAttributes

        HttpResponseCookie clearAttributes()
        Clears the attributes.
        Returns:
        this.