Methods Summary |
---|
public java.util.List | formatCookies(java.util.List cookies)
if (cookies == null) {
throw new IllegalArgumentException("List of cookie may not be null");
}
int version = Integer.MAX_VALUE;
for (Cookie cookie: cookies) {
if (cookie.getVersion() < version) {
version = cookie.getVersion();
}
}
if (version > 0) {
return getStrict().formatCookies(cookies);
} else {
return getCompat().formatCookies(cookies);
}
|
private org.apache.http.impl.cookie.BrowserCompatSpec | getCompat()
if (this.compat == null) {
this.compat = new BrowserCompatSpec(this.datepatterns);
}
return compat;
|
private org.apache.http.impl.cookie.NetscapeDraftSpec | getNetscape()
if (this.netscape == null) {
String[] patterns = this.datepatterns;
if (patterns == null) {
patterns = BrowserCompatSpec.DATE_PATTERNS;
}
this.netscape = new NetscapeDraftSpec(patterns);
}
return netscape;
|
private org.apache.http.impl.cookie.RFC2965Spec | getStrict()
if (this.strict == null) {
this.strict = new RFC2965Spec(this.datepatterns, this.oneHeader);
}
return strict;
|
public int | getVersion()
return getStrict().getVersion();
|
public org.apache.http.Header | getVersionHeader()
return getStrict().getVersionHeader();
|
public boolean | match(org.apache.http.cookie.Cookie cookie, org.apache.http.cookie.CookieOrigin origin)
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (origin == null) {
throw new IllegalArgumentException("Cookie origin may not be null");
}
if (cookie.getVersion() > 0) {
return getStrict().match(cookie, origin);
} else {
return getCompat().match(cookie, origin);
}
|
public java.util.List | parse(org.apache.http.Header header, org.apache.http.cookie.CookieOrigin origin)
if (header == null) {
throw new IllegalArgumentException("Header may not be null");
}
if (origin == null) {
throw new IllegalArgumentException("Cookie origin may not be null");
}
HeaderElement[] helems = header.getElements();
boolean versioned = false;
boolean netscape = false;
for (HeaderElement helem: helems) {
if (helem.getParameterByName("version") != null) {
versioned = true;
}
if (helem.getParameterByName("expires") != null) {
netscape = true;
}
}
if (netscape) {
}
// Do we have a cookie with a version attribute?
if (versioned) {
return getStrict().parse(helems, origin);
} else if (netscape) {
// Need to parse the header again,
// because Netscape draft cannot handle
// comma separators
return getNetscape().parse(header, origin);
} else {
return getCompat().parse(helems, origin);
}
|
public void | validate(org.apache.http.cookie.Cookie cookie, org.apache.http.cookie.CookieOrigin origin)
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (origin == null) {
throw new IllegalArgumentException("Cookie origin may not be null");
}
if (cookie.getVersion() > 0) {
getStrict().validate(cookie, origin);
} else {
getCompat().validate(cookie, origin);
}
|