Package ortus.boxlang.web.exchange
Class BoxCookie
java.lang.Object
ortus.boxlang.web.exchange.BoxCookie
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanstatic BoxCookiefromEncoded(String name, String value) Create a new cookie from an incoming cookie header, decoding the value.Get the encoded cookie value in a format suitable for the HTTP header.getName()getPath()getValue()intfinal inthashCode()booleanbooleanbooleanbooleanisSecure()setComment(String comment) setDiscard(boolean discard) setExpires(Date expires) setHttpOnly(boolean httpOnly) setSameSite(boolean sameSite) setSameSiteMode(String mode) Set the SameSite mode for the cookie.setSecure(boolean secure) This always returns the NON-encoded value, even if encodeValue is set to true.setVersion(int version) Generate the Set-Cookie header value for this cookie.final StringtoString()
-
Constructor Details
-
BoxCookie
-
BoxCookie
-
BoxCookie
-
-
Method Details
-
getName
-
getValue
-
getEncodedValue
Get the encoded cookie value in a format suitable for the HTTP header. If encodeValue is set to false, this will return the value as-is.- Returns:
- The cookie value, encoded if necessary
-
setValue
This always returns the NON-encoded value, even if encodeValue is set to true.- Parameters:
value- The cookie value with no encoding. Do NOT use this to set an HTTP SET-COOKIE header.- Returns:
- The BoxCookie instance for chaining
-
getPath
-
setPath
-
getDomain
-
setDomain
-
getMaxAge
-
setMaxAge
-
isDiscard
public boolean isDiscard() -
setDiscard
-
isSecure
public boolean isSecure() -
setSecure
-
getVersion
public int getVersion() -
setVersion
-
isHttpOnly
public boolean isHttpOnly() -
setHttpOnly
-
getExpires
-
setExpires
-
getComment
-
setComment
-
isSameSite
public boolean isSameSite() -
setSameSite
-
getSameSiteMode
-
setSameSiteMode
Set the SameSite mode for the cookie. This will automatically set the SameSite flag to true.- Parameters:
mode- One of the strings Strict, Lax, or None- Returns:
-
hashCode
public final int hashCode() -
equals
-
toString
-
fromEncoded
Create a new cookie from an incoming cookie header, decoding the value.- Parameters:
name- The cookie namevalue- The encoded cookie value- Returns:
- A new BoxCookie instance with the name and value set
-
toSetCookieHeader
Generate the Set-Cookie header value for this cookie.- Returns:
- A string representing the Set-Cookie header value.
-