Package 

Class Cookie

  • All Implemented Interfaces:

    
    public final class Cookie
    
                        

    An HTTP cookie (web cookie, browser cookie) is a small piece of data that a server sends to a user's web browser. The browser may store the cookie and send it back to the same server with later requests. Typically, an HTTP cookie is used to tell if two requests come from the same browser.

    • Constructor Detail

      • Cookie

        Cookie(String name, String value, String path, Integer maxAge, Boolean secure, Integer version, Boolean isHttpOnly, String comment, String domain, SameSite sameSite)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
        maxAge - indicates the number of seconds until the cookie expires.
        secure - indicates that the cookie is sent to the server only when a request is made with the https: scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks (default: false)
        version - the version of the protocol this cookie complies with (default: 0)
        isHttpOnly - if true, forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.
        comment - a comment that describes a cookie's purpose (default: null)
        domain - defines the host to which the cookie will be sent.
        sameSite - controls whether or not a cookie is sent with cross-site requests, providing some protection against cross-site request forgery attacks (CSRF).
      • Cookie

        Cookie(String name, String value, String path, Integer maxAge, Boolean secure, Integer version, Boolean isHttpOnly, String comment, String domain)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
        maxAge - indicates the number of seconds until the cookie expires.
        secure - indicates that the cookie is sent to the server only when a request is made with the https: scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks (default: false)
        version - the version of the protocol this cookie complies with (default: 0)
        isHttpOnly - if true, forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.
        comment - a comment that describes a cookie's purpose (default: null)
        domain - defines the host to which the cookie will be sent.
      • Cookie

        Cookie(String name, String value, String path, Integer maxAge, Boolean secure, Integer version, Boolean isHttpOnly, String comment)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
        maxAge - indicates the number of seconds until the cookie expires.
        secure - indicates that the cookie is sent to the server only when a request is made with the https: scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks (default: false)
        version - the version of the protocol this cookie complies with (default: 0)
        isHttpOnly - if true, forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.
        comment - a comment that describes a cookie's purpose (default: null)
      • Cookie

        Cookie(String name, String value, String path, Integer maxAge, Boolean secure, Integer version, Boolean isHttpOnly)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
        maxAge - indicates the number of seconds until the cookie expires.
        secure - indicates that the cookie is sent to the server only when a request is made with the https: scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks (default: false)
        version - the version of the protocol this cookie complies with (default: 0)
        isHttpOnly - if true, forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.
      • Cookie

        Cookie(String name, String value, String path, Integer maxAge, Boolean secure, Integer version)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
        maxAge - indicates the number of seconds until the cookie expires.
        secure - indicates that the cookie is sent to the server only when a request is made with the https: scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks (default: false)
        version - the version of the protocol this cookie complies with (default: 0)
      • Cookie

        Cookie(String name, String value, String path, Integer maxAge, Boolean secure)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
        maxAge - indicates the number of seconds until the cookie expires.
        secure - indicates that the cookie is sent to the server only when a request is made with the https: scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks (default: false)
      • Cookie

        Cookie(String name, String value, String path, Integer maxAge)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
        maxAge - indicates the number of seconds until the cookie expires.
      • Cookie

        Cookie(String name, String value, String path)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
      • Cookie

        Cookie(String name, String value)
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
    • Method Detail

      • setPath

         final Unit setPath(String path)
        Parameters:
        path - indicates the path that must exist in the requested URL for the browser to send the Cookie header.
      • setMaxAge

         final Unit setMaxAge(Integer maxAge)
        Parameters:
        maxAge - indicates the number of seconds until the cookie expires.
      • setSecure

         final Unit setSecure(Boolean secure)
        Parameters:
        secure - indicates that the cookie is sent to the server only when a request is made with the https: scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks (default: false)
      • setVersion

         final Unit setVersion(Integer version)
        Parameters:
        version - the version of the protocol this cookie complies with (default: 0)
      • setHttpOnly

         final Unit setHttpOnly(Boolean isHttpOnly)
        Parameters:
        isHttpOnly - if true, forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.
      • setComment

         final Unit setComment(String comment)
        Parameters:
        comment - a comment that describes a cookie's purpose (default: null)
      • setDomain

         final Unit setDomain(String domain)
        Parameters:
        domain - defines the host to which the cookie will be sent.
      • setSameSite

         final Unit setSameSite(SameSite sameSite)
        Parameters:
        sameSite - controls whether or not a cookie is sent with cross-site requests, providing some protection against cross-site request forgery attacks (CSRF).