Package com.mastfrog.netty.http.client
Class CookieStore
java.lang.Object
com.mastfrog.netty.http.client.CookieStore
- All Implemented Interfaces:
Iterable<io.netty.handler.codec.http.cookie.Cookie>
public final class CookieStore
extends Object
implements Iterable<io.netty.handler.codec.http.cookie.Cookie>
Stores cookies from responses and decorates requests with them where
appropriate.
- Author:
- Tim Boudreau
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a cookie store which will check domains and paths when adding cookies.CookieStore(boolean checkDomain, boolean checkPath) Create a cookie store. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(io.netty.handler.codec.http.cookie.Cookie cookie) Returns a new CookieStore which will check the path parameter of cookies when deciding to add them to a request.Returns a new CookieStore which does not check the path parameter of cookies when deciding to add them to a request.booleanerrorHandler(Receiver<Throwable> errorHandler) Add a handler which will be called if an exception is thrown when parsing cookies - i.e.inthashCode()booleanisEmpty()Iterator<io.netty.handler.codec.http.cookie.Cookie>iterator()voidread(InputStream in) voidintsize()voidstore(OutputStream out) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CookieStore
public CookieStore(boolean checkDomain, boolean checkPath) Create a cookie store.- Parameters:
checkDomain- Ignore cookies with the wrong domaincheckPath- Ignore cookies that do not match the path
-
CookieStore
public CookieStore()Create a cookie store which will check domains and paths when adding cookies.
-
-
Method Details
-
checkDomain
-
dontCheckDomain
-
size
public int size() -
isEmpty
public boolean isEmpty() -
checkPath
Returns a new CookieStore which will check the path parameter of cookies when deciding to add them to a request. This is the default.- Returns:
- A new CookieStore
-
dontCheckPath
Returns a new CookieStore which does not check the path parameter of cookies when deciding to add them to a request.- Returns:
- A new CookieStore
-
errorHandler
Add a handler which will be called if an exception is thrown when parsing cookies - i.e. a server gave an invalid value for the cookie header. If not set, the exception will be thrown.- Parameters:
errorHandler- An error handler- Returns:
- this
-
get
-
add
public void add(io.netty.handler.codec.http.cookie.Cookie cookie) -
remove
-
toString
-
iterator
-
store
- Throws:
IOException
-
read
- Throws:
IOException
-
hashCode
public int hashCode() -
equals
-