|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.hccp.net.CookieManager
CookieManager is a simple utilty for handling cookies when working
with java.net.URL and java.net.URLConnection
objects.
Cookiemanager cm = new CookieManager();
URL url = new URL("http://www.hccp.org/test/cookieTest.jsp");
. . .
// getting cookies:
URLConnection conn = url.openConnection();
conn.connect();
// setting cookies
cm.storeCookies(conn);
cm.setCookies(url.openConnection());
| Constructor Summary | |
CookieManager()
|
|
| Method Summary | |
static void |
main(java.lang.String[] args)
|
void |
setCookies(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 method or an IOException will be thrown. |
void |
storeCookies(java.net.URLConnection conn)
Retrieves and stores cookies returned by the host on the other side of the the open java.net.URLConnection. |
java.lang.String |
toString()
Returns a string representation of stored cookies organized by domain. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public CookieManager()
| Method Detail |
public void storeCookies(java.net.URLConnection conn)
throws java.io.IOException
conn - a java.net.URLConnection - must be open, or IOException will be thrown
java.io.IOException - Thrown if conn is not open.
public void setCookies(java.net.URLConnection conn)
throws java.io.IOException
conn - a java.net.URLConnection - must NOT be open, or IOException will be thrown
java.io.IOException - Thrown if conn has already been opened.public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||