public class CookieX extends Cookie
Modifier and Type | Field and Description |
---|---|
static int |
DURATION_YEAR_S
A max-age value of roughly one year as measured in seconds.
|
Constructor and Description |
---|
CookieX(String name,
String value)
Constructs a CookieX without encoding the value.
|
CookieX(String name,
String value,
boolean toEncode)
Constructs a CookieX.
|
Modifier and Type | Method and Description |
---|---|
static String |
decodedValue(String encodedValue)
Decodes a previously
encodedValue and returns the result. |
static String |
encodedValue(String decodedValue)
Encodes the value such that it has no illegal characters and returns the result.
|
void |
setValue(String value) |
void |
setValue(String value,
boolean toEncode) |
void |
setVersion(int version) |
clone, getComment, getDomain, getMaxAge, getName, getPath, getSecure, getValue, getVersion, setComment, setDomain, setMaxAge, setPath, setSecure
public static final int DURATION_YEAR_S
public CookieX(String name, String value)
IllegalArgumentException
- if either the name or value contains an
illegal character.Cookie.getName()
,
Cookie.getValue()
,
Cookie.Cookie(String,String)
public CookieX(String name, String value, boolean toEncode)
toEncode
- whether to encode the
value. IfIllegalArgumentException
- if the name contains an illegal character, or
if the value contains an illegal character and assertions are enabled.Cookie.getName()
,
Cookie.getValue()
,
Cookie.Cookie(String,String)
@ThreadSafe public static String decodedValue(String encodedValue)
encodedValue
and returns the result.encodedValue
- the value to decode. Null values decode to null.encodedValue(String)
@ThreadSafe public static String encodedValue(String decodedValue)
decodedValue
- the value to encode. Null values encode to null.decodedValue(String)
,
Non-ASCII characters in URI attribute valuespublic final void setValue(String value)
setValue
in class Cookie
IllegalArgumentException
- if the value contains an illegal character.public final void setValue(String value, boolean toEncode)
IllegalArgumentException
- if the value contains an illegal character
and assertions are enabled.public final void setVersion(int version)
setVersion
in class Cookie
IllegalArgumentException
- if the version is not zero. The argument
checking performed by this class is probably not necessary for later versions.