public class Cookie extends Object
Constructor and Description |
---|
Cookie() |
Modifier and Type | Method and Description |
---|---|
static String |
escape(String string)
Produce a copy of a string in which the characters '+', '%', '=', ';'
and control characters are replaced with "%hh".
|
static JSONObject |
toJSONObject(String string)
Convert a cookie specification string into a JSONObject.
|
static String |
toString(JSONObject jo)
Convert a JSONObject into a cookie specification string.
|
static String |
unescape(String string)
Convert
% hh sequences to single characters, and
convert plus to space. |
public static String escape(String string)
string
- The source string.public static JSONObject toJSONObject(String string)
Boolean.TRUE
will be used for these).
The name will be stored under the key "name", and the value will be
stored under the key "value". This method does not do checking or
validation of the parameters. It only converts the cookie string into
a JSONObject. All attribute names are converted to lower case keys in the
JSONObject (HttpOnly => httponly). If an attribute is specified more than
once, only the value found closer to the end of the cookie-string is kept.string
- The cookie specification string.JSONException
- If there is an error parsing the Cookie String.
Cookie strings must have at least one '=' character and the 'name'
portion of the cookie must not be blank.public static String toString(JSONObject jo) throws JSONException
jo
- A JSONObjectJSONException
- thrown if the cookie has no name.