Top Description Fields Constructors Methods
io.vertx.core.http.impl

public Class CookieImpl

extends Object
implements ServerCookie
Class Inheritance
All Implemented Interfaces
io.vertx.core.http.impl.ServerCookie, io.vertx.core.http.Cookie
Imports
io.netty.handler.codec.http.cookie.DefaultCookie, .ServerCookieEncoder, io.vertx.core.http.Cookie, .CookieSameSite

Vert.x cookie implementation
Authors
Paulo Lopes, Tim Fox

Field Summary

Modifier and TypeField and Description
private boolean
private final boolean
private final Cookie
private CookieSameSite

Constructor Summary

AccessConstructor and Description
public
CookieImpl(String name, String value)

pack-priv
CookieImpl(Cookie
the underlying cookie object
nettyCookie
)

Internal constructor, only used by the CookieJar.

Method Summary

Modifier and TypeMethod and Description
public String
encode()

Implements io.vertx.core.http.Cookie.encode.

Encode the cookie to a string.

public String
public long
public String
public String
public CookieSameSite
public String
public boolean
isChanged()

Implements io.vertx.core.http.impl.ServerCookie.isChanged.

Has the cookie been changed?

public boolean
isFromUserAgent()

Implements io.vertx.core.http.impl.ServerCookie.isFromUserAgent.

Has this Cookie been sent from the User Agent (the browser)?

public boolean
public boolean
public void
setChanged(boolean
true if changed
changed
)

Implements io.vertx.core.http.impl.ServerCookie.setChanged.

Set the cookie as being changed.

public Cookie
setDomain(final String domain)

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

Implements io.vertx.core.http.Cookie.setHttpOnly.

Determines if this cookie is HTTP only.

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

Implements io.vertx.core.http.Cookie.setMaxAge.

Sets the maximum age of this cookie in seconds.

public Cookie
setPath(final String path)

public Cookie
setSameSite(final CookieSameSite
The policy should be one of CookieSameSite.
sameSite
)

Implements io.vertx.core.http.Cookie.setSameSite.

Sets the same site of this cookie.

public Cookie
setSecure(final boolean
True if this cookie is to be secure, otherwise false
secure
)

Implements io.vertx.core.http.Cookie.setSecure.

Sets the security getStatus of this cookie

public Cookie
setValue(final String
The value to set
value
)

Implements io.vertx.core.http.Cookie.setValue.

Sets the value of this cookie

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

changedback to summary
private boolean changed
fromUserAgentback to summary
private final boolean fromUserAgent
nettyCookieback to summary
private final Cookie nettyCookie
sameSiteback to summary
private CookieSameSite sameSite

Constructor Detail

CookieImplback to summary
public CookieImpl(String name, String value)
CookieImplback to summary
pack-priv CookieImpl(Cookie nettyCookie)

Internal constructor, only used by the CookieJar.

Parameters
nettyCookie:Cookie

the underlying cookie object

Method Detail

encodeback to summary
public String encode()

Implements io.vertx.core.http.Cookie.encode.

Doc from io.vertx.core.http.Cookie.encode.

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

Returns:String

the encoded cookie

Annotations
@Override
getDomainback to summary
public String getDomain()

Implements io.vertx.core.http.Cookie.getDomain.

Returns:String

Doc from io.vertx.core.http.Cookie.getDomain.

the domain for the cookie

Annotations
@Override
getMaxAgeback to summary
public long getMaxAge()

Implements io.vertx.core.http.Cookie.getMaxAge.

Returns:long

Doc from io.vertx.core.http.Cookie.getMaxAge.

the maxAge of this cookie

Annotations
@Override
getNameback to summary
public String getName()

Implements io.vertx.core.http.Cookie.getName.

Returns:String

Doc from io.vertx.core.http.Cookie.getName.

the name of this cookie

Annotations
@Override
getPathback to summary
public String getPath()

Implements io.vertx.core.http.Cookie.getPath.

Returns:String

Doc from io.vertx.core.http.Cookie.getPath.

the path for this cookie

Annotations
@Override
getSameSiteback to summary
public CookieSameSite getSameSite()

Implements io.vertx.core.http.Cookie.getSameSite.

Returns:CookieSameSite

Doc from io.vertx.core.http.Cookie.getSameSite.

the SameSite policy of this cookie

Annotations
@Override
getValueback to summary
public String getValue()

Implements io.vertx.core.http.Cookie.getValue.

Returns:String

Doc from io.vertx.core.http.Cookie.getValue.

the value of this cookie

Annotations
@Override
isChangedback to summary
public boolean isChanged()

Implements io.vertx.core.http.impl.ServerCookie.isChanged.

Doc from io.vertx.core.http.impl.ServerCookie.isChanged.

Has the cookie been changed? Changed cookie jar will be saved out in the response and sent to the browser.

Returns:boolean

true if changed

isFromUserAgentback to summary
public boolean isFromUserAgent()

Implements io.vertx.core.http.impl.ServerCookie.isFromUserAgent.

Doc from io.vertx.core.http.impl.ServerCookie.isFromUserAgent.

Has this Cookie been sent from the User Agent (the browser)? or was created during the executing on the request.

Returns:boolean

true if the cookie comes from the User Agent.

isHttpOnlyback to summary
public boolean isHttpOnly()

Implements io.vertx.core.http.Cookie.isHttpOnly.

Returns:boolean

Doc from io.vertx.core.http.Cookie.isHttpOnly.

the http only status of this cookie

Annotations
@Override
isSecureback to summary
public boolean isSecure()

Implements io.vertx.core.http.Cookie.isSecure.

Returns:boolean

Doc from io.vertx.core.http.Cookie.isSecure.

the security status of this cookie

Annotations
@Override
setChangedback to summary
public void setChanged(boolean changed)

Implements io.vertx.core.http.impl.ServerCookie.setChanged.

Doc from io.vertx.core.http.impl.ServerCookie.setChanged.

Set the cookie as being changed. Changed will be true for a cookie just created, false by default if just read from the request

Parameters
changed:boolean

true if changed

setDomainback to summary
public Cookie setDomain(final String domain)
Annotations
@Override
setHttpOnlyback to summary
public Cookie setHttpOnly(final boolean httpOnly)

Implements io.vertx.core.http.Cookie.setHttpOnly.

Doc from io.vertx.core.http.Cookie.setHttpOnly.

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
@Override
setMaxAgeback to summary
public Cookie setMaxAge(final long maxAge)

Implements io.vertx.core.http.Cookie.setMaxAge.

Doc from io.vertx.core.http.Cookie.setMaxAge.

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
@Override
setPathback to summary
public Cookie setPath(final String path)
Annotations
@Override
setSameSiteback to summary
public Cookie setSameSite(final CookieSameSite sameSite)

Implements io.vertx.core.http.Cookie.setSameSite.

Doc from io.vertx.core.http.Cookie.setSameSite.

Sets the same site of this cookie.

Parameters
sameSite:CookieSameSite

The policy should be one of CookieSameSite.

Returns:Cookie

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

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

Implements io.vertx.core.http.Cookie.setSecure.

Doc from io.vertx.core.http.Cookie.setSecure.

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
@Override
setValueback to summary
public Cookie setValue(final String value)

Implements io.vertx.core.http.Cookie.setValue.

Doc from io.vertx.core.http.Cookie.setValue.

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
@Override