public class DefaultCookieParser extends BaseValueParser implements CookieParser
Use set() or unset() to Create or Destroy Cookies.
NOTE: The name= portion of a name=value pair may be converted to lowercase or uppercase when the object is initialized and when new data is added. This behaviour is determined by the url.case.folding property in TurbineResources.properties. Adding a name/value pair may overwrite existing name=value pairs if the names match:
CookieParser cp = data.getCookies();
cp.add("ERROR",1);
cp.add("eRrOr",2);
int result = cp.getInt("ERROR");
In the above example, result is 2.ValueParser.URLCaseFoldingparameters, parserServiceAGE_DELETE, AGE_SESSIONDEFAULT_CHARACTER_ENCODING| Constructor and Description |
|---|
DefaultCookieParser()
Constructs a new CookieParser.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes the parser.
|
HttpServletRequest |
getRequest()
Gets the servlet request.
|
boolean |
isValid() |
void |
set(String name,
String value)
Set a cookie that will be stored on the client for
the duration of the session.
|
void |
set(String name,
String value,
int seconds_age)
Set a persistent cookie on the client that will expire
after a maximum age (given in seconds).
|
void |
setData(HttpServletRequest request,
HttpServletResponse response)
Sets the servlet request and response to be parsed.
|
void |
unset(String name)
Remove a previously set cookie from the client machine.
|
add, add, add, add, add, add, clear, containsKey, convert, convertAndTrim, convertAndTrim, enableLogging, get, getBigDecimal, getBigDecimal, getBigDecimals, getBoolean, getBoolean, getBooleanObject, getBooleanObject, getBooleanObjects, getBooleans, getByte, getByte, getByteObject, getByteObject, getBytes, getCharacterEncoding, getDate, getDate, getDate, getDateFormat, getDouble, getDouble, getDoubleObject, getDoubleObject, getDoubleObjects, getDoubles, getFloat, getFloat, getFloatObject, getFloatObject, getFloatObjects, getFloats, getInt, getInt, getIntObject, getIntObject, getIntObjects, getInts, getKeys, getLocale, getLogger, getLong, getLong, getLongObject, getLongObject, getLongObjects, getLongs, getNumberFormat, getObject, getObjects, getParam, getString, getString, getStrings, getStrings, getToStringParam, getUrlFolding, isDisposed, iterator, keySet, putParam, recycle, recycle, remove, setCharacterEncoding, setDateFormat, setLocale, setNumberFormat, setParserService, setProperties, setProperty, setString, setStrings, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, add, add, add, add, add, clear, containsKey, convert, convertAndTrim, convertAndTrim, get, getBigDecimal, getBigDecimal, getBigDecimals, getBoolean, getBoolean, getBooleanObject, getBooleanObject, getBooleanObjects, getBooleans, getByte, getByte, getByteObject, getByteObject, getBytes, getCharacterEncoding, getDate, getDate, getDate, getDateFormat, getDouble, getDouble, getDoubleObject, getDoubleObject, getDoubleObjects, getDoubles, getFloat, getFloat, getFloatObject, getFloatObject, getFloatObjects, getFloats, getInt, getInt, getIntObject, getIntObject, getIntObjects, getInts, getKeys, getLocale, getLong, getLong, getLongObject, getLongObject, getLongObjects, getLongs, getNumberFormat, getObject, getObjects, getString, getString, getStrings, getStrings, getUrlFolding, keySet, remove, setCharacterEncoding, setDateFormat, setLocale, setNumberFormat, setProperties, setString, setStrings, toStringforEach, iterator, spliteratorpublic void dispose()
dispose in interface ValueParserdispose in class BaseValueParserpublic HttpServletRequest getRequest()
getRequest in interface CookieParserpublic void setData(HttpServletRequest request, HttpServletResponse response)
setData in interface CookieParserrequest - the servlet request object.response - the servlet response objectpublic void set(String name, String value)
set in interface CookieParsername - The name of the cookievalue - The value of the cookingpublic void set(String name, String value, int seconds_age)
CookieParserset in interface CookieParsername - A String for the namevalue - A String for the valueseconds_age - An int for the age in secondspublic void unset(String name)
CookieParserunset in interface CookieParsername - the name of the cooking to unsetpublic boolean isValid()
isValid in interface CookieParserisValid in class BaseValueParserCopyright © 2005–2019 The Apache Software Foundation. All rights reserved.