Top Fields Constructors Methods
org.apache.tomcat.util.http

public Class Rfc6265CookieProcessor

extends CookieProcessorBase
Class Inheritance
Imports
java.nio.charset.Charset, .StandardCharsets, java.text.FieldPosition, java.util.BitSet, .Date, .Map, jakarta.servlet.http.HttpServletRequest, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.buf.ByteChunk, .MessageBytes, org.apache.tomcat.util.descriptor.web.Constants, org.apache.tomcat.util.http.parser.Cookie, .HttpParser, org.apache.tomcat.util.res.StringManager

Field Summary

Modifier and TypeField and Description
private static final BitSet
private static final Log
private static final StringManager
Inherited from org.apache.tomcat.util.http.CookieProcessorBase:
ANCIENT_DATECOOKIE_DATE_FORMAT

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
generateHeader(Cookie
The cookie for which the header will be generated
cookie
,
HttpServletRequest
The servlet request
request
)

Implements org.apache.tomcat.util.http.CookieProcessor.generateHeader.

Generate the Set-Cookie HTTP header value for the given Cookie.

public Charset
getCharset()

Implements org.apache.tomcat.util.http.CookieProcessor.getCharset.

Obtain the character set that will be used when converting between bytes and characters when parsing and/or generating HTTP headers for cookies.

public void
parseCookieHeader(MimeHeaders
The HTTP headers to parse
headers
,
ServerCookies
The server cookies object to populate with the results of the parsing
serverCookies
)

Implements org.apache.tomcat.util.http.CookieProcessor.parseCookieHeader.

Parse the provided headers into server cookie objects.

private void
private void
private void
private void
Inherited from org.apache.tomcat.util.http.CookieProcessorBase:
getPartitionedgetSameSiteCookiessetPartitionedsetSameSiteCookies

Field Detail

domainValidback to summary
private static final BitSet domainValid
logback to summary
private static final Log log
smback to summary
private static final StringManager sm

Constructor Detail

Rfc6265CookieProcessorback to summary
public Rfc6265CookieProcessor()

Method Detail

generateHeaderback to summary
public String generateHeader(Cookie cookie, HttpServletRequest request)

Implements org.apache.tomcat.util.http.CookieProcessor.generateHeader.

Doc from org.apache.tomcat.util.http.CookieProcessor.generateHeader.

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.

Parameters
cookie:Cookie

The cookie for which the header will be generated

request:HttpServletRequest

The servlet request

Returns:String

The header value in a form that can be added directly to the response

Annotations
@Override
getCharsetback to summary
public Charset getCharset()

Implements org.apache.tomcat.util.http.CookieProcessor.getCharset.

Doc from org.apache.tomcat.util.http.CookieProcessor.getCharset.

Obtain the character set that will be used when converting between bytes and characters when parsing and/or generating HTTP headers for cookies.

Returns:Charset

The character set used for byte<->character conversions

Annotations
@Override
parseCookieHeaderback to summary
public void parseCookieHeader(MimeHeaders headers, ServerCookies serverCookies)

Implements org.apache.tomcat.util.http.CookieProcessor.parseCookieHeader.

Doc from org.apache.tomcat.util.http.CookieProcessor.parseCookieHeader.

Parse the provided headers into server cookie objects.

Parameters
headers:MimeHeaders

The HTTP headers to parse

serverCookies:ServerCookies

The server cookies object to populate with the results of the parsing

Annotations
@Override
validateAttributeback to summary
private void validateAttribute(String name, String value)
validateCookieValueback to summary
private void validateCookieValue(String value)
validateDomainback to summary
private void validateDomain(String domain)
validatePathback to summary
private void validatePath(String path)