wjhk.jupload2.upload
Class CookieJar

java.lang.Object
  extended by wjhk.jupload2.upload.CookieJar

public class CookieJar
extends Object

This class implements a container for multiple cookies in a single domain.

Author:
felfert

Field Summary
(package private) static Pattern pNvPair
           
 
Constructor Summary
CookieJar()
           
 
Method Summary
 String buildCookieHeader(URL url)
          Builds a RFC 2109 compliant client cookie header for the specified URL.
 void parseCookieHeader(String s)
          Parses a "Set-Cookie" header and creates/updates/deletes cookies according to the parsed values.
 void setDomain(String domain)
          Sets the domain for this cookie jar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pNvPair

static final Pattern pNvPair
Constructor Detail

CookieJar

public CookieJar()
Method Detail

setDomain

public void setDomain(String domain)
Sets the domain for this cookie jar. If set, only cookies matching the specified domain are handled.

Parameters:
domain - The domain of this instance

buildCookieHeader

public String buildCookieHeader(URL url)
Builds a RFC 2109 compliant client cookie header for the specified URL.

Parameters:
url - The URL for which the cookie header is to be used.
Returns:
A client cookie header (including the "Cookie: " prefix) or null if no cookies are to be set.

parseCookieHeader

public void parseCookieHeader(String s)
Parses a "Set-Cookie" header and creates/updates/deletes cookies according to the parsed values. Parsing is done according to the specification in RFC 2109

Parameters:
s - The plain value of the "Set-Cookie" HTTP header. e.g.: without the "Set-Cookie: " prefix.