public final class HttpCookieMgr
extends java.lang.Object
Constructor and Description |
---|
HttpCookieMgr()
Constructor
Sets the default timezone and sets up a store for the cookie values
|
Modifier and Type | Method and Description |
---|---|
void |
addCookie(java.lang.String host,
java.lang.String cookieName,
java.lang.String paramValue)
Sets the value of a cookie
|
void |
addCookie(java.lang.String host,
java.lang.String cookieName,
java.lang.String paramName,
java.lang.String paramValue)
Sets the value of a cookie parameter
|
void |
applyCookies(java.net.URLConnection conn)
Prior to opening a URLConnection, calling this method will set all
unexpired cookies that match the path or subpaths for thi underlying URL
The connection MUST NOT have been opened or an IOException will be thrown.
|
java.lang.String |
getCookie(java.lang.String host,
java.lang.String cookieName)
Retrieves the value of the cookie
|
void |
retrieveCookies(java.net.URLConnection conn)
Retrieves and stores cookies returned by the host on the other side
of the the open java.net.URLConnection.
|
void |
setTimeZone(java.util.TimeZone tz)
Sets the timezone used when comparing if cookies have expired
|
java.lang.String |
toString()
Returns a string representation of stored cookies organized by domain.
|
public HttpCookieMgr()
public void setTimeZone(java.util.TimeZone tz)
tz
- - timezonepublic void retrieveCookies(java.net.URLConnection conn) throws java.io.IOException
conn
- a java.net.URLConnection - must be open, or IOException will be thrownjava.io.IOException
- Thrown if conn is not open.public java.lang.String getCookie(java.lang.String host, java.lang.String cookieName)
host
- - host that the cookie is related tocookieName
- - the name of the cookiepublic void addCookie(java.lang.String host, java.lang.String cookieName, java.lang.String paramValue)
host
- - the host that the cookie is related tocookieName
- - the name of the cookieparamValue
- - the value to set the cookie topublic void addCookie(java.lang.String host, java.lang.String cookieName, java.lang.String paramName, java.lang.String paramValue)
host
- - the host that the cookie is related tocookieName
- - the name of the cookieparamName
- - parameter nameparamValue
- - the value to set the cookie topublic void applyCookies(java.net.URLConnection conn) throws java.io.IOException
conn
- a java.net.URLConnection - must NOT be open, or IOException will be thrownjava.io.IOException
- Thrown if conn has already been opened.@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in class java.lang.Object
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.