servicenow.community.soap
Class CookieJar

java.lang.Object
  extended by servicenow.community.soap.CookieJar

public class CookieJar
extends java.lang.Object

The CookieJar class is used to hold HTTP cookies. It knows how to read a cookie from an HttpURLConnection (fetchFromConnection) and how to write cookies from an HttpConnection.

In the context of this application the CookieJar contains only a single cookie: JSESSIONID

Author:
Giles Lewis

Constructor Summary
CookieJar()
           
 
Method Summary
 java.lang.String getAllCookies()
           
 java.lang.String getCookie(java.lang.String name)
           
 boolean isEmpty()
           
 void load(java.net.HttpURLConnection connection, boolean clear)
          Reads all cookies from an HttpURLConnection and save them in the jar
 void postAll(java.net.HttpURLConnection connection)
          Write all the cookies in the jar to the HttpURLConnection.
 void setCookie(java.lang.String name, java.lang.String value)
          Save a cookie in the cookie jar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieJar

public CookieJar()
Method Detail

load

public void load(java.net.HttpURLConnection connection,
                 boolean clear)
Reads all cookies from an HttpURLConnection and save them in the jar

Parameters:
connection - HTTP Connection from which the cookie will be retrieved
clear - If true then empty the jar before loading

setCookie

public void setCookie(java.lang.String name,
                      java.lang.String value)
Save a cookie in the cookie jar.

Parameters:
name - Name of cookie
value - String value of cookie

getCookie

public java.lang.String getCookie(java.lang.String name)

isEmpty

public boolean isEmpty()

getAllCookies

public java.lang.String getAllCookies()

postAll

public void postAll(java.net.HttpURLConnection connection)
Write all the cookies in the jar to the HttpURLConnection.

Parameters:
connection - HTTP Connection to which cookies will be posted using setRequestProperty