com.sun.faban.driver.transport.sunhttp
Class CookieHandler

java.lang.Object
  extended by java.net.CookieHandler
      extended by com.sun.faban.driver.transport.sunhttp.CookieHandler

public class CookieHandler
extends CookieHandler

Faban's implementation of the cookie handler.

Author:
Akara Sucharitakul

Constructor Summary
CookieHandler()
           
 
Method Summary
 Map<String,List<String>> get(URI uri, Map<String,List<String>> map)
          Gets all the applicable cookies from a cookie cache for the specified uri in the request header.
 void put(URI uri, Map<String,List<String>> responseHeaders)
          Sets all the applicable cookies, examples are response header fields that are named Set-Cookie2, present in the response headers into a cookie cache.
 
Methods inherited from class java.net.CookieHandler
getDefault, setDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieHandler

public CookieHandler()
Method Detail

get

public Map<String,List<String>> get(URI uri,
                                    Map<String,List<String>> map)
Gets all the applicable cookies from a cookie cache for the specified uri in the request header. HTTP protocol implementers should make sure that this method is called after all request headers related to choosing cookies are added, and before the request is sent.

Specified by:
get in class CookieHandler
Parameters:
uri - a URI to send cookies to in a request
map - - a Map from request header field names to lists of field values representing the current request headers
Returns:
an immutable map from state management headers, with field names "Cookie" or "Cookie2" to a list of cookies containing state information
Throws:
IllegalArgumentException - if either argument is null
See Also:
put(URI, Map), CookieHandler.get(java.net.URI, java.util.Map)

put

public void put(URI uri,
                Map<String,List<String>> responseHeaders)
Sets all the applicable cookies, examples are response header fields that are named Set-Cookie2, present in the response headers into a cookie cache.

Specified by:
put in class CookieHandler
Parameters:
uri - a URI where the cookies come from
responseHeaders - an immutable responseHeaders from field names to lists of field values representing the response header fields returned
Throws:
IllegalArgumentException - if either argument is null
See Also:
get(URI, Map)