Rfc6265CookieProcessor (Apache Tomcat 8.5.87 API Documentation)

Package org.apache.tomcat.util.http

## Class Rfc6265CookieProcessor

- java.lang.Object
- - org.apache.tomcat.util.http.CookieProcessorBase
  - - org.apache.tomcat.util.http.Rfc6265CookieProcessor

- All Implemented Interfaces:
    `CookieProcessor`

      public class Rfc6265CookieProcessor
      extends CookieProcessorBase

- - ### Field Summary

    - ### Fields inherited from class org.apache.tomcat.util.http.CookieProcessorBase

      `ANCIENT_DATE, COOKIE_DATE_FORMAT`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Rfc6265CookieProcessor()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `generateHeader​(Cookie cookie)` | Generate the `Set-Cookie` HTTP header value for the given Cookie.
    `java.lang.String` | `generateHeader​(Cookie cookie, HttpServletRequest request)` | Generate the `Set-Cookie` HTTP header value for the given Cookie.
    `java.nio.charset.Charset` | `getCharset()` | Obtain the character set that will be used when converting between bytes and characters when parsing and/or generating HTTP headers for cookies.
    `void` | `parseCookieHeader​(MimeHeaders headers, ServerCookies serverCookies)` | Parse the provided headers into server cookie objects.

    - ### Methods inherited from class org.apache.tomcat.util.http.CookieProcessorBase

      `getSameSiteCookies, setSameSiteCookies`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Rfc6265CookieProcessor

          public Rfc6265CookieProcessor()

  - ### Method Detail

    - #### getCharset

          public java.nio.charset.Charset getCharset()

      Description copied from interface: `CookieProcessor`
      Obtain the character set that will be used when converting between bytes and characters when parsing and/or generating HTTP headers for cookies.
      Returns:
        The character set used for byte<->character conversions

    - #### parseCookieHeader

          public void parseCookieHeader​(MimeHeaders headers,
                                        ServerCookies serverCookies)

      Description copied from interface: `CookieProcessor`
      Parse the provided headers into server cookie objects.
      Parameters:
        `headers` - The HTTP headers to parse
        `serverCookies` - The server cookies object to populate with the results of the parsing

    - #### generateHeader

          public java.lang.String generateHeader​(Cookie cookie)

      Description copied from interface: `CookieProcessor`
      Generate the `Set-Cookie` HTTP header value for the given Cookie.
      Parameters:
        `cookie` - The cookie for which the header will be generated
      Returns:
        The header value in a form that can be added directly to the response

    - #### generateHeader

          public java.lang.String generateHeader​(Cookie cookie,
                                                 HttpServletRequest request)

      Description copied from class: `CookieProcessorBase`
      Generate the `Set-Cookie` HTTP header value for the given Cookie. This method receives as parameter the servlet request so that it can make decisions based on request properties. One such use-case is decide if the SameSite attribute should be added to the cookie based on the User-Agent or other request header because there are browser versions incompatible with the SameSite attribute. This is described by the Chromium project.
      Specified by:
        `generateHeader` in interface `CookieProcessor`
      Overrides:
        `generateHeader` in class `CookieProcessorBase`
      Parameters:
        `cookie` - The cookie for which the header will be generated
        `request` - The servlet request
      Returns:
        The header value in a form that can be added directly to the response