Package fi.iki.elonen
Class NanoHTTPD.CookieHandler
java.lang.Object
fi.iki.elonen.NanoHTTPD.CookieHandler
- Enclosing class:
NanoHTTPD
Provides rudimentary support for cookies. Doesn't support 'path',
'secure' nor 'httpOnly'. Feel free to improve it and/or add unsupported
features.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Set a cookie with an expiration date from a month ago, effectively deleting it on the client side.iterator()
Read a cookie from the HTTP Headers.void
set
(NanoHTTPD.Cookie cookie) void
Sets a cookie.void
unloadQueue
(NanoHTTPD.Response response) Internally used by the webserver to add all queued cookies into the Response's HTTP Headers.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
cookies
-
queue
-
-
Constructor Details
-
CookieHandler
-
-
Method Details
-
delete
Set a cookie with an expiration date from a month ago, effectively deleting it on the client side.- Parameters:
name
- The cookie name.
-
iterator
-
read
Read a cookie from the HTTP Headers.- Parameters:
name
- The cookie's name.- Returns:
- The cookie's value if it exists, null otherwise.
-
set
-
set
Sets a cookie.- Parameters:
name
- The cookie's name.value
- The cookie's value.expires
- How many days until the cookie expires.
-
unloadQueue
Internally used by the webserver to add all queued cookies into the Response's HTTP Headers.- Parameters:
response
- The Response object to which headers the queued cookies will be added.
-