|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.microsoft.tfs.core.httpclient.cookie.CookieSpecBase
public class CookieSpecBase
Cookie management functions shared by all specification.
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
LOG
Log object |
| Fields inherited from interface com.microsoft.tfs.core.httpclient.cookie.CookieSpec |
|---|
PATH_DELIM, PATH_DELIM_CHAR |
| Constructor Summary | |
|---|---|
CookieSpecBase()
Default constructor |
|
| Method Summary | |
|---|---|
boolean |
domainMatch(java.lang.String host,
java.lang.String domain)
Performs domain-match as implemented in common browsers. |
java.lang.String |
formatCookie(Cookie cookie)
Return a string suitable for sending in a "Cookie" header |
Header |
formatCookieHeader(Cookie cookie)
Create a "Cookie" Header containing the Cookie. |
Header |
formatCookieHeader(Cookie[] cookies)
Create a "Cookie" Header containing all Cookies
in cookies. |
java.lang.String |
formatCookies(Cookie[] cookies)
Create a "Cookie" header value containing all Cookies in
cookies suitable for sending in a "Cookie" header |
java.util.Collection<java.text.SimpleDateFormat> |
getValidDateFormats()
Returns the Collection of date patterns used for parsing. |
boolean |
match(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
Cookie cookie)
Return true if the cookie should be submitted with a request with given attributes, false otherwise. |
Cookie[] |
match(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
Cookie[] cookies)
Return an array of Cookies that should be submitted with a
request with given attributes, false otherwise. |
Cookie[] |
parse(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
Header header)
Parse the "Set-Cookie" Header into an array of
Cookies. |
Cookie[] |
parse(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
java.lang.String header)
Parses the Set-Cookie value into an array of Cookies. |
Cookie[] |
parse(java.net.URI uri,
Header header)
Parse the "Set-Cookie" header value into Cookie array. |
Cookie[] |
parse(java.net.URI uri,
java.lang.String header)
Parse the "Set-Cookie" header value into Cookie array. |
void |
parseAttribute(NameValuePair attribute,
Cookie cookie)
Parse the cookie attribute and update the corresponsing Cookie
properties. |
boolean |
pathMatch(java.lang.String path,
java.lang.String topmostPath)
Performs path-match as implemented in common browsers. |
void |
setValidDateFormats(java.util.Collection<java.text.SimpleDateFormat> datepatterns)
Sets the Collection of date patterns used for parsing. |
void |
validate(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
Cookie cookie)
Performs most common Cookie validation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log LOG
| Constructor Detail |
|---|
public CookieSpecBase()
| Method Detail |
|---|
public Cookie[] parse(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
java.lang.String header)
throws MalformedCookieException
The syntax for the Set-Cookie response header is:
set-cookie = "Set-Cookie:" cookies
cookies = 1#cookie
cookie = NAME "=" VALUE * (";" cookie-av)
NAME = attr
VALUE = value
cookie-av = "Comment" "=" value
| "Domain" "=" value
| "Max-Age" "=" value
| "Path" "=" value
| "Secure"
| "Version" "=" 1*DIGIT
parse in interface CookieSpechost - the host from which the Set-Cookie value was receivedport - the port from which the Set-Cookie value was receivedpath - the path from which the Set-Cookie value was receivedsecure - true when the Set-Cookie value was received over
secure conectionheader - the Set-Cookie received from the server
MalformedCookieException - if an exception occurs during parsingCookieSpec.validate(String, int, String, boolean, Cookie)
public Cookie[] parse(java.net.URI uri,
java.lang.String header)
throws MalformedCookieException,
java.lang.IllegalArgumentException
This method will not perform the validation of the resultant
Cookies
parse in interface CookieSpecuri - the uri that sent the Set-Cookie headerheader - the Set-Cookie received from the server
MalformedCookieException - if an exception occurs during parsing
java.lang.IllegalArgumentException - if an input parameter is illegalvalidate(String, int, String, boolean, Cookie)
public Cookie[] parse(java.net.URI uri,
Header header)
throws MalformedCookieException,
java.lang.IllegalArgumentException
This method will not perform the validation of the resultant
Cookies
parse in interface CookieSpecuri - the uri that sent the Set-Cookie headerheader - the Set-Cookie received from the server
MalformedCookieException - if an exception occurs during parsing
java.lang.IllegalArgumentException - if an input parameter is illegalvalidate(String, int, String, boolean, Cookie)
public Cookie[] parse(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
Header header)
throws MalformedCookieException
Header into an array of
Cookies.
The syntax for the Set-Cookie response header is:
set-cookie = "Set-Cookie:" cookies
cookies = 1#cookie
cookie = NAME "=" VALUE * (";" cookie-av)
NAME = attr
VALUE = value
cookie-av = "Comment" "=" value
| "Domain" "=" value
| "Max-Age" "=" value
| "Path" "=" value
| "Secure"
| "Version" "=" 1*DIGIT
parse in interface CookieSpechost - the host from which the Set-Cookie header was receivedport - the port from which the Set-Cookie header was receivedpath - the path from which the Set-Cookie header was receivedsecure - true when the Set-Cookie header was received
over secure conectionheader - the Set-Cookie received from the server
MalformedCookieException - if an exception occurs during parsingCookieSpec.validate(String, int, String, boolean, Cookie)
public void parseAttribute(NameValuePair attribute,
Cookie cookie)
throws MalformedCookieException
Cookie
properties.
parseAttribute in interface CookieSpecattribute - HeaderElement cookie attribute from the
Set- Cookiecookie - Cookie to be updated
MalformedCookieException - if an exception occurs during parsingpublic java.util.Collection<java.text.SimpleDateFormat> getValidDateFormats()
CookieSpecCollection of date patterns used for parsing. The
String patterns are compatible with the
SimpleDateFormat.
getValidDateFormats in interface CookieSpecpublic void setValidDateFormats(java.util.Collection<java.text.SimpleDateFormat> datepatterns)
CookieSpecCollection of date patterns used for parsing. The String
patterns must be compatible with SimpleDateFormat.
setValidDateFormats in interface CookieSpecdatepatterns - collection of date patterns
public void validate(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
Cookie cookie)
throws MalformedCookieException
Cookie validation
validate in interface CookieSpechost - the host from which the Cookie was receivedport - the port from which the Cookie was receivedpath - the path from which the Cookie was receivedsecure - true when the Cookie was received using a secure
connectioncookie - The cookie to validate.
MalformedCookieException - if an exception occurs during validation
public boolean match(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
Cookie cookie)
match in interface CookieSpechost - the host to which the request is being submittedport - the port to which the request is being submitted (ignored)path - the path to which the request is being submittedsecure - true if the request is using a secure connectioncookie - Cookie to be matched
public boolean domainMatch(java.lang.String host,
java.lang.String domain)
domainMatch in interface CookieSpechost - The target host.domain - The cookie domain attribute.
public boolean pathMatch(java.lang.String path,
java.lang.String topmostPath)
pathMatch in interface CookieSpecpath - The target path.topmostPath - The cookie path attribute.
public Cookie[] match(java.lang.String host,
int port,
java.lang.String path,
boolean secure,
Cookie[] cookies)
Cookies that should be submitted with a
request with given attributes, false otherwise.
match in interface CookieSpechost - the host to which the request is being submittedport - the port to which the request is being submitted (currently
ignored)path - the path to which the request is being submittedsecure - true if the request is using a secure protocolcookies - an array of Cookies to be matched
public java.lang.String formatCookie(Cookie cookie)
formatCookie in interface CookieSpeccookie - a Cookie to be formatted as string
public java.lang.String formatCookies(Cookie[] cookies)
throws java.lang.IllegalArgumentException
Cookies in
cookies suitable for sending in a "Cookie" header
formatCookies in interface CookieSpeccookies - an array of Cookies to be formatted
java.lang.IllegalArgumentException - if an input parameter is illegalpublic Header formatCookieHeader(Cookie[] cookies)
Header containing all Cookies
in cookies.
formatCookieHeader in interface CookieSpeccookies - an array of Cookies to be formatted as a "
Cookie" header
Header.public Header formatCookieHeader(Cookie cookie)
Header containing the Cookie.
formatCookieHeader in interface CookieSpeccookie - Cookies to be formatted as a Cookie header
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||