Top Description Methods
io.vertx.core.http

public Interface Cookie

Known Direct Subinterfaces
io.vertx.core.http.impl.ServerCookie
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.Fluent, .Nullable, .VertxGen, io.vertx.core.http.impl.CookieImpl

Represents an HTTP Cookie.

All cookies must have a name and a value and can optionally have other fields set such as path, domain, etc.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the encoded cookie
encode
()

Encode the cookie to a string.

public @Nullable String

Returns:

the domain for the cookie
getDomain
()

public long

Returns:

the maxAge of this cookie
getMaxAge
()

public String

Returns:

the name of this cookie
getName
()

public @Nullable String

Returns:

the path for this cookie
getPath
()

public @Nullable CookieSameSite

Returns:

the SameSite policy of this cookie
getSameSite
()

public String

Returns:

the value of this cookie
getValue
()

public boolean

Returns:

the http only status of this cookie
isHttpOnly
()

public boolean

Returns:

the security status of this cookie
isSecure
()

public Cookie

Returns:

a reference to this, so the API can be used fluently
setDomain
(@Nullable String
The domain to use
domain
)

Sets the domain of this cookie

public Cookie
setHttpOnly(boolean
True if the cookie is HTTP only, otherwise false.
httpOnly
)

Determines if this cookie is HTTP only.

public Cookie
setMaxAge(long
The maximum age of this cookie in seconds
maxAge
)

Sets the maximum age of this cookie in seconds.

public Cookie

Returns:

a reference to this, so the API can be used fluently
setPath
(@Nullable String
The path to use for this cookie
path
)

Sets the path of this cookie.

public Cookie

Returns:

a reference to this, so the API can be used fluently
setSameSite
(CookieSameSite
The policy should be one of CookieSameSite.
policy
)

Sets the same site of this cookie.

public Cookie

Returns:

a reference to this, so the API can be used fluently
setSecure
(boolean
True if this cookie is to be secure, otherwise false
secure
)

Sets the security getStatus of this cookie

public Cookie

Returns:

a reference to this, so the API can be used fluently
setValue
(String
The value to set
value
)

Sets the value of this cookie

Method Detail

encodeback to summary
public String encode()

Encode the cookie to a string. This is what is used in the Set-Cookie header

Returns:String

the encoded cookie

getDomainback to summary
public @Nullable String getDomain()
Returns:@Nullable String

the domain for the cookie

getMaxAgeback to summary
public long getMaxAge()
Returns:long

the maxAge of this cookie

getNameback to summary
public String getName()
Returns:String

the name of this cookie

getPathback to summary
public @Nullable String getPath()
Returns:@Nullable String

the path for this cookie

getSameSiteback to summary
public @Nullable CookieSameSite getSameSite()
Returns:@Nullable CookieSameSite

the SameSite policy of this cookie

getValueback to summary
public String getValue()
Returns:String

the value of this cookie

isHttpOnlyback to summary
public boolean isHttpOnly()
Returns:boolean

the http only status of this cookie

isSecureback to summary
public boolean isSecure()
Returns:boolean

the security status of this cookie

setDomainback to summary
public Cookie setDomain(@Nullable String domain)

Sets the domain of this cookie

Parameters
domain:@Nullable String

The domain to use

Returns:Cookie

a reference to this, so the API can be used fluently

Annotations
@Fluent
setHttpOnlyback to summary
public Cookie setHttpOnly(boolean httpOnly)

Determines if this cookie is HTTP only. If set to true, this cookie cannot be accessed by a client side script. However, this works only if the browser supports it. For for information, please look here.

Parameters
httpOnly:boolean

True if the cookie is HTTP only, otherwise false.

Annotations
@Fluent
setMaxAgeback to summary
public Cookie setMaxAge(long maxAge)

Sets the maximum age of this cookie in seconds. If an age of 0 is specified, this cookie will be automatically removed by browser because it will expire immediately. If Long#MIN_VALUE is specified, this cookie will be removed when the browser is closed. If you don't set this the cookie will be a session cookie and be removed when the browser is closed.

Parameters
maxAge:long

The maximum age of this cookie in seconds

Annotations
@Fluent
setPathback to summary
public Cookie setPath(@Nullable String path)

Sets the path of this cookie.

Parameters
path:@Nullable String

The path to use for this cookie

Returns:Cookie

a reference to this, so the API can be used fluently

Annotations
@Fluent
setSameSiteback to summary
public Cookie setSameSite(CookieSameSite policy)

Sets the same site of this cookie.

Parameters
policy:CookieSameSite

The policy should be one of CookieSameSite.

Returns:Cookie

a reference to this, so the API can be used fluently

Annotations
@Fluent
setSecureback to summary
public Cookie setSecure(boolean secure)

Sets the security getStatus of this cookie

Parameters
secure:boolean

True if this cookie is to be secure, otherwise false

Returns:Cookie

a reference to this, so the API can be used fluently

Annotations
@Fluent
setValueback to summary
public Cookie setValue(String value)

Sets the value of this cookie

Parameters
value:String

The value to set

Returns:Cookie

a reference to this, so the API can be used fluently

Annotations
@Fluent