| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.httpclient.cookie.CookieSpecBase
org.apache.commons.httpclient.cookie.RFC2965Spec
public class RFC2965Spec
RFC 2965 specific cookie management functions.
| Field Summary | |
|---|---|
| static String | SET_COOKIE2_KEYCookie Response Header name for cookies processed by this spec. | 
| Fields inherited from class org.apache.commons.httpclient.cookie.CookieSpecBase | 
|---|
| LOG | 
| Fields inherited from interface org.apache.commons.httpclient.cookie.CookieSpec | 
|---|
| PATH_DELIM, PATH_DELIM_CHAR | 
| Constructor Summary | |
|---|---|
| RFC2965Spec()Default constructor | |
| Method Summary | |
|---|---|
|  boolean | domainMatch(String host,
            String domain)Performs domain-match as defined by the RFC2965. | 
| protected  CookieAttributeHandler | findAttribHandler(String name)Finds an attribute handler CookieAttributeHandlerfor the
 given attribute. | 
|  String | formatCookie(Cookie cookie)Return a string suitable for sending in a "Cookie" header as defined in RFC 2965 | 
|  String | formatCookies(Cookie[] cookies)Create a RFC 2965 compliant "Cookie" header value containing all Cookies suitable for
 sending in a "Cookie" header | 
| protected  CookieAttributeHandler | getAttribHandler(String name)Gets attribute handler CookieAttributeHandlerfor the
 given attribute. | 
| protected  Iterator | getAttribHandlerIterator() | 
|  int | getVersion() | 
|  Header | getVersionHeader() | 
|  boolean | match(String host,
      int port,
      String path,
      boolean secure,
      Cookie cookie)Return true if the cookie should be submitted with a request with given attributes, false otherwise. | 
|  Cookie[] | parse(String host,
      int port,
      String path,
      boolean secure,
      Header header)Parses the Set-Cookie2 value into an array of Cookies. | 
|  Cookie[] | parse(String host,
      int port,
      String path,
      boolean secure,
      String header)Parses the Set-Cookie value into an array of Cookies. | 
|  void | parseAttribute(NameValuePair attribute,
               Cookie cookie)Parse RFC 2965 specific cookie attribute and update the corresponsing Cookieproperties. | 
| protected  void | registerAttribHandler(String name,
                      CookieAttributeHandler handler) | 
|  void | validate(String host,
         int port,
         String path,
         boolean secure,
         Cookie cookie)Performs RFC 2965 compliant Cookievalidation | 
| Methods inherited from class org.apache.commons.httpclient.cookie.CookieSpecBase | 
|---|
| formatCookieHeader, formatCookieHeader, getValidDateFormats, match, pathMatch, setValidDateFormats | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final String SET_COOKIE2_KEY
| Constructor Detail | 
|---|
public RFC2965Spec()
| Method Detail | 
|---|
protected void registerAttribHandler(String name,
                                     CookieAttributeHandler handler)
protected CookieAttributeHandler findAttribHandler(String name)
CookieAttributeHandler for the
 given attribute. Returns null if no attribute handler is
 found for the specified attribute.
name - attribute name. e.g. Domain, Path, etc.
protected CookieAttributeHandler getAttribHandler(String name)
CookieAttributeHandler for the
 given attribute.
name - attribute name. e.g. Domain, Path, etc.
IllegalStateException - if handler not found for the
          specified attribute.protected Iterator getAttribHandlerIterator()
public Cookie[] parse(String host,
                      int port,
                      String path,
                      boolean secure,
                      Header header)
               throws MalformedCookieException
The syntax for the Set-Cookie2 response header is:
 set-cookie      =    "Set-Cookie2:" cookies
 cookies         =    1#cookie
 cookie          =    NAME "=" VALUE * (";" cookie-av)
 NAME            =    attr
 VALUE           =    value
 cookie-av       =    "Comment" "=" value
                 |    "CommentURL" "=" <"> http_URL <">
                 |    "Discard"
                 |    "Domain" "=" value
                 |    "Max-Age" "=" value
                 |    "Path" "=" value
                 |    "Port" [ "=" <"> portlist <"> ]
                 |    "Secure"
                 |    "Version" "=" 1*DIGIT
 portlist        =       1#portnum
 portnum         =       1*DIGIT
 
parse in interface CookieSpecparse in class CookieSpecBasehost - the host from which the Set-Cookie2 value was
 receivedport - the port from which the Set-Cookie2 value was
 receivedpath - the path from which the Set-Cookie2 value was
 receivedsecure - true when the Set-Cookie2 value was
 received over secure conectionheader - the Set-Cookie2 Header received from the server
MalformedCookieException - if an exception occurs during parsingCookieSpec.validate(String, int, String, boolean, Cookie)
public Cookie[] parse(String host,
                      int port,
                      String path,
                      boolean secure,
                      String header)
               throws MalformedCookieException
CookieSpecBaseThe 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 CookieSpecparse in class CookieSpecBasehost - 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 parsingparse(String, int, String, boolean, org.apache.commons.httpclient.Header)
public void parseAttribute(NameValuePair attribute,
                           Cookie cookie)
                    throws MalformedCookieException
Cookie properties.
parseAttribute in interface CookieSpecparseAttribute in class CookieSpecBaseattribute - NameValuePair cookie attribute from the
 Set-Cookie2 header.cookie - Cookie to be updated
MalformedCookieException - if an exception occurs during parsing
public void validate(String host,
                     int port,
                     String path,
                     boolean secure,
                     Cookie cookie)
              throws MalformedCookieException
Cookie validation
validate in interface CookieSpecvalidate in class CookieSpecBasehost - 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(String host,
                     int port,
                     String path,
                     boolean secure,
                     Cookie cookie)
match in interface CookieSpecmatch in class CookieSpecBasehost - 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 String formatCookie(Cookie cookie)
formatCookie in interface CookieSpecformatCookie in class CookieSpecBasecookie - a Cookie to be formatted as string
public String formatCookies(Cookie[] cookies)
Cookies suitable for
 sending in a "Cookie" header
formatCookies in interface CookieSpecformatCookies in class CookieSpecBasecookies - an array of Cookies to be formatted
public boolean domainMatch(String host,
                           String domain)
Host A's name domain-matches host B's if
domainMatch in interface CookieSpecdomainMatch in class CookieSpecBasehost - host name where cookie is received from or being sent to.domain - The cookie domain attribute.
public int getVersion()
getVersion in interface CookieVersionSupportpublic Header getVersionHeader()
getVersionHeader in interface CookieVersionSupport| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||