Top Description Inners Fields Constructors Methods
io.netty5.handler.codec.http.headers

public final Class DefaultHttpSetCookie

extends Object
implements HttpSetCookie
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.http.headers.HttpSetCookie, io.netty5.handler.codec.http.headers.HttpCookiePair
Imports
io.netty5.util.AsciiString, org.jetbrains.annotations.NotNull, .Nullable

Default implementation of HttpSetCookie.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private final @Nullable CharSequence
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private final @Nullable CharSequence
private final boolean
private final @Nullable Long
private final CharSequence
private final @Nullable CharSequence
private final @Nullable HttpSetCookie.SameSite
private final boolean
private final CharSequence
private final boolean

Constructor Summary

AccessConstructor and Description
public
DefaultHttpSetCookie(final CharSequence name, final CharSequence value)

Create a new not wrapped, not secure and not HTTP-only HttpSetCookie instance, with no path, domain, expire date and maximum age.

public
DefaultHttpSetCookie(final CharSequence name, final CharSequence value, final boolean
true if the value should be wrapped in DQUOTE as described in cookie-value.
wrapped
,
final boolean secure, final boolean httpOnly)

Create a new HttpSetCookie instance, with no path, domain, expire date and maximum age.

public
DefaultHttpSetCookie(final CharSequence name, final CharSequence value, final @Nullable CharSequence path, final @Nullable CharSequence domain, final @Nullable CharSequence
the expires-av. Represented as an RFC-1123 date defined in RFC-2616, Section 3.3.1.
expires
,
final @Nullable Long maxAge, final @Nullable HttpSetCookie.SameSite sameSite, final boolean
true if the value should be wrapped in DQUOTE as described in cookie-value.
wrapped
,
final boolean secure, final boolean httpOnly)

Creates a new HttpSetCookie instance.

Method Summary

Modifier and TypeMethod and Description
public @Nullable CharSequence
public CharSequence
public boolean
equals(final Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
private static boolean
equalsIgnoreCaseLower(char c, char k)

public @Nullable CharSequence
expires()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.expires.

Returns the expire date of this HttpSetCookie according to Expires.
private static @Nullable HttpSetCookie.SameSite
fromSequence(CharSequence cs, int begin, int end)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
isHttpOnly()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.isHttpOnly.

Checks to see if this HttpSetCookie can only be accessed via HTTP.
public boolean
public boolean
isWrapped()

Implements io.netty5.handler.codec.http.headers.HttpCookiePair.isWrapped.

Returns true if the value should be wrapped in DQUOTE as described in cookie-value.
public @Nullable Long
maxAge()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.maxAge.

Returns the maximum age of this HttpSetCookie in seconds if specified.
public CharSequence
pack-priv static HttpSetCookie
parseSetCookie(final CharSequence setCookieString, boolean validateContent, @Nullable CharSequence name, int i)

public static HttpSetCookie

Returns:

a HttpSetCookie representation of setCookie.
parseSetCookie
(final CharSequence setCookieString, boolean
true to make a best effort to validate the contents of the SetCookie.
validateContent
)

Parse a setCookie CharSequence into a HttpSetCookie.

private static DefaultHttpSetCookie.ParseState
public @Nullable CharSequence
public @Nullable HttpSetCookie.SameSite
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private static @NotNull IllegalArgumentException
unexpectedHexValue(int hexValue, int index)

private static void
validateCookieAttributeValue(final int
The decimal representation of the hexadecimal value.
hexValue
,
int
The index of the character in the inputs, for error reporting.
index
)

Attribute values are any CHAR except CTLs or ";", and CTLs are %x00 to %x1F, and %x7F.

private static void
validateCookieOctetHexValue(final int
The decimal representation of the hexadecimal value.
hexValue
,
int
The index of the character in the inputs, for error reporting.
index
)

cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E

public CharSequence
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

domainback to summary
private final @Nullable CharSequence domain
Annotations
@Nullable
ENCODED_LABEL_DOMAINback to summary
private static final String ENCODED_LABEL_DOMAIN
ENCODED_LABEL_EXPIRESback to summary
private static final String ENCODED_LABEL_EXPIRES
ENCODED_LABEL_HTTP_ONLYback to summary
private static final String ENCODED_LABEL_HTTP_ONLY
ENCODED_LABEL_MAX_AGEback to summary
private static final String ENCODED_LABEL_MAX_AGE
ENCODED_LABEL_PATHback to summary
private static final String ENCODED_LABEL_PATH
ENCODED_LABEL_SAMESITEback to summary
private static final String ENCODED_LABEL_SAMESITE
ENCODED_LABEL_SECUREback to summary
private static final String ENCODED_LABEL_SECURE
expiresback to summary
private final @Nullable CharSequence expires
Annotations
@Nullable
httpOnlyback to summary
private final boolean httpOnly
maxAgeback to summary
private final @Nullable Long maxAge
Annotations
@Nullable
nameback to summary
private final CharSequence name
pathback to summary
private final @Nullable CharSequence path
Annotations
@Nullable
sameSiteback to summary
private final @Nullable HttpSetCookie.SameSite sameSite
Annotations
@Nullable
secureback to summary
private final boolean secure
valueback to summary
private final CharSequence value
wrappedback to summary
private final boolean wrapped

Constructor Detail

DefaultHttpSetCookieback to summary
public DefaultHttpSetCookie(final CharSequence name, final CharSequence value)

Create a new not wrapped, not secure and not HTTP-only HttpSetCookie instance, with no path, domain, expire date and maximum age.

Parameters
name:CharSequence

the cookie-name.

value:CharSequence

the cookie-value.

DefaultHttpSetCookieback to summary
public DefaultHttpSetCookie(final CharSequence name, final CharSequence value, final boolean wrapped, final boolean secure, final boolean httpOnly)

Create a new HttpSetCookie instance, with no path, domain, expire date and maximum age.

Parameters
name:CharSequence

the cookie-name.

value:CharSequence

the cookie-value.

wrapped:boolean

true if the value should be wrapped in DQUOTE as described in cookie-value.

secure:boolean

the secure-av.

httpOnly:boolean

the httponly-av (see HTTP-only).

DefaultHttpSetCookieback to summary
public DefaultHttpSetCookie(final CharSequence name, final CharSequence value, final @Nullable CharSequence path, final @Nullable CharSequence domain, final @Nullable CharSequence expires, final @Nullable Long maxAge, final @Nullable HttpSetCookie.SameSite sameSite, final boolean wrapped, final boolean secure, final boolean httpOnly)

Creates a new HttpSetCookie instance.

Parameters
name:CharSequence

the cookie-name.

value:CharSequence

the cookie-value.

path:@Nullable CharSequence

the path-value.

domain:@Nullable CharSequence

the domain-value.

expires:@Nullable CharSequence

the expires-av. Represented as an RFC-1123 date defined in RFC-2616, Section 3.3.1.

maxAge:@Nullable Long

the max-age-av.

sameSite:@Nullable HttpSetCookie.SameSite

the SameSite attribute.

wrapped:boolean

true if the value should be wrapped in DQUOTE as described in cookie-value.

secure:boolean

the secure-av.

httpOnly:boolean

the httponly-av (see HTTP-only).

Method Detail

domainback to summary
public @Nullable CharSequence domain()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.domain.

Doc from io.netty5.handler.codec.http.headers.HttpSetCookie.domain.

Returns the domain of this HttpSetCookie.

Returns:@Nullable CharSequence

The domain of this HttpSetCookie

Annotations
@Nullable
@Override
encodedback to summary
public CharSequence encoded()

Implements io.netty5.handler.codec.http.headers.HttpCookiePair.encoded.

Doc from io.netty5.handler.codec.http.headers.HttpCookiePair.encoded.

Get the encoded value of this HttpCookiePair.

Returns:CharSequence

the encoded value of this HttpCookiePair.

Annotations
@Override
equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
equalsIgnoreCaseLowerback to summary
private static boolean equalsIgnoreCaseLower(char c, char k)
expiresback to summary
public @Nullable CharSequence expires()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.expires.

Doc from io.netty5.handler.codec.http.headers.HttpSetCookie.expires.

Returns the expire date of this HttpSetCookie according to Expires.

Returns:@Nullable CharSequence

the expire date of this HttpSetCookie according to Expires.

Annotations
@Nullable
@Override
fromSequenceback to summary
private static @Nullable HttpSetCookie.SameSite fromSequence(CharSequence cs, int begin, int end)
Annotations
@Nullable
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isHttpOnlyback to summary
public boolean isHttpOnly()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.isHttpOnly.

Doc from io.netty5.handler.codec.http.headers.HttpSetCookie.isHttpOnly.

Checks to see if this HttpSetCookie can only be accessed via HTTP. If this returns true, the HttpSetCookie cannot be accessed through client side script - But only if the browser supports it. For more information, please look here

Returns:boolean

True if this HttpSetCookie is HTTP-only or false if it isn't

Annotations
@Override
isSecureback to summary
public boolean isSecure()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.isSecure.

Doc from io.netty5.handler.codec.http.headers.HttpSetCookie.isSecure.

Checks to see if this HttpSetCookie is secure.

Returns:boolean

True if this HttpSetCookie is secure, otherwise false

Annotations
@Override
isWrappedback to summary
public boolean isWrapped()

Implements io.netty5.handler.codec.http.headers.HttpCookiePair.isWrapped.

Doc from io.netty5.handler.codec.http.headers.HttpCookiePair.isWrapped.

Returns true if the value should be wrapped in DQUOTE as described in cookie-value.

Returns:boolean

true if the value should be wrapped in DQUOTE as described in cookie-value.

Annotations
@Override
maxAgeback to summary
public @Nullable Long maxAge()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.maxAge.

Doc from io.netty5.handler.codec.http.headers.HttpSetCookie.maxAge.

Returns the maximum age of this HttpSetCookie in seconds if specified.

Returns:@Nullable Long

The maximum age of this HttpSetCookie. null if none specified.

Annotations
@Nullable
@Override
nameback to summary
public CharSequence name()

Implements io.netty5.handler.codec.http.headers.HttpCookiePair.name.

Doc from io.netty5.handler.codec.http.headers.HttpCookiePair.name.

Returns the name of this HttpCookiePair.

Returns:CharSequence

The name of this HttpCookiePair

Annotations
@Override
parseSetCookieback to summary
pack-priv static HttpSetCookie parseSetCookie(final CharSequence setCookieString, boolean validateContent, @Nullable CharSequence name, int i)
parseSetCookieback to summary
public static HttpSetCookie parseSetCookie(final CharSequence setCookieString, boolean validateContent)

Parse a setCookie CharSequence into a HttpSetCookie.

Parameters
setCookieString:CharSequence

The set-cookie-string value.

validateContent:boolean

true to make a best effort to validate the contents of the SetCookie.

Returns:HttpSetCookie

a HttpSetCookie representation of setCookie.

parseStateOfback to summary
private static DefaultHttpSetCookie.ParseState parseStateOf(CharSequence fieldName)
pathback to summary
public @Nullable CharSequence path()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.path.

Doc from io.netty5.handler.codec.http.headers.HttpSetCookie.path.

Returns the path of this HttpSetCookie.

Returns:@Nullable CharSequence

The HttpSetCookie's path

Annotations
@Nullable
@Override
sameSiteback to summary
public @Nullable HttpSetCookie.SameSite sameSite()

Implements io.netty5.handler.codec.http.headers.HttpSetCookie.sameSite.

Doc from io.netty5.handler.codec.http.headers.HttpSetCookie.sameSite.

Get the value for the SameSite attribute.

Returns:@Nullable HttpSetCookie.SameSite

The value for the SameSite attribute.

Annotations
@Nullable
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
unexpectedHexValueback to summary
private static @NotNull IllegalArgumentException unexpectedHexValue(int hexValue, int index)
Annotations
@NotNull
validateCookieAttributeValueback to summary
private static void validateCookieAttributeValue(final int hexValue, int index)

Attribute values are any CHAR except CTLs or ";", and CTLs are %x00 to %x1F, and %x7F.

Parameters
hexValue:int

The decimal representation of the hexadecimal value.

index:int

The index of the character in the inputs, for error reporting.

validateCookieOctetHexValueback to summary
private static void validateCookieOctetHexValue(final int hexValue, int index)

cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E

Parameters
hexValue:int

The decimal representation of the hexadecimal value.

index:int

The index of the character in the inputs, for error reporting.

valueback to summary
public CharSequence value()

Implements io.netty5.handler.codec.http.headers.HttpCookiePair.value.

Doc from io.netty5.handler.codec.http.headers.HttpCookiePair.value.

Returns the value of this HttpCookiePair.

Returns:CharSequence

The value of this HttpCookiePair

Annotations
@Override
io.netty5.handler.codec.http.headers back to summary

private final Enum DefaultHttpSetCookie.ParseState

extends Enum<DefaultHttpSetCookie.ParseState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final DefaultHttpSetCookie.ParseState
public static final DefaultHttpSetCookie.ParseState
public static final DefaultHttpSetCookie.ParseState
public static final DefaultHttpSetCookie.ParseState
public static final DefaultHttpSetCookie.ParseState
public static final DefaultHttpSetCookie.ParseState
public static final DefaultHttpSetCookie.ParseState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static DefaultHttpSetCookie.ParseState
public static DefaultHttpSetCookie.ParseState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ParsingDomainback to summary
public static final DefaultHttpSetCookie.ParseState ParsingDomain
ParsingExpiresback to summary
public static final DefaultHttpSetCookie.ParseState ParsingExpires
ParsingMaxAgeback to summary
public static final DefaultHttpSetCookie.ParseState ParsingMaxAge
ParsingPathback to summary
public static final DefaultHttpSetCookie.ParseState ParsingPath
ParsingSameSiteback to summary
public static final DefaultHttpSetCookie.ParseState ParsingSameSite
ParsingValueback to summary
public static final DefaultHttpSetCookie.ParseState ParsingValue
Unknownback to summary
public static final DefaultHttpSetCookie.ParseState Unknown

Constructor Detail

ParseStateback to summary
private ParseState()

Method Detail

valueOfback to summary
public static DefaultHttpSetCookie.ParseState valueOf(String name)
valuesback to summary
public static DefaultHttpSetCookie.ParseState[] values()