Package org.jdrupes.httpcodec.types
Class CookieList
java.lang.Object
org.jdrupes.httpcodec.types.CookieList
- All Implemented Interfaces:
Iterable<HttpCookie>
Represents a list of cookies.
The additional property “same site attribute” controls the generation of header fields.
-
Constructor Summary
ConstructorDescriptionCreates a new empty cookie list.CookieList
(Collection<HttpCookie> existing) Creates a new list with items copied from the existing collection.CookieList
(Converters.SameSiteAttribute sameSiteAttribute) Creates a new empty cookie list with the specified same-site attribute. -
Method Summary
Modifier and TypeMethodDescriptionadd
(HttpCookie cookie) Adds a cookie to the list.clear()
Removes all cookies from the list.boolean
isEmpty()
iterator()
boolean
Remove the cookie with the given name.Returns the same site attribute passed to the constructor.int
size()
stream()
valueForName
(String name) Returns the value for the cookie with the given name.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
-
Constructor Details
-
CookieList
Creates a new empty cookie list with the specified same-site attribute. -
CookieList
public CookieList()Creates a new empty cookie list. -
CookieList
Creates a new list with items copied from the existing collection.- Parameters:
existing
- the existing collection
-
-
Method Details
-
sameSiteAttribute
Returns the same site attribute passed to the constructor.- Returns:
- the same site attribute
-
valueForName
Returns the value for the cookie with the given name.- Parameters:
name
- the name- Returns:
- the value if a cookie with the given name exists
-
add
Adds a cookie to the list.If a cookie with the same name already exists, it is replaced.
- Parameters:
cookie
- the cookie- Returns:
- the cookie list for easy chaining
-
clear
Removes all cookies from the list.- Returns:
- the cookie list for easy chaining
-
isEmpty
-
iterator
- Specified by:
iterator
in interfaceIterable<HttpCookie>
-
stream
-
remove
Remove the cookie with the given name.- Parameters:
name
-- Returns:
- the cookie list for easy chaining
-
size
-