|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.httpclient.cookie.CookieSpecBase org.apache.commons.httpclient.cookie.NetscapeDraftSpec
public class NetscapeDraftSpec
Netscape cookie draft specific cookie management functions
Field Summary |
---|
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 | |
---|---|
NetscapeDraftSpec()
Default constructor |
Method Summary | |
---|---|
boolean |
domainMatch(String host,
String domain)
Performs domain-match as described in the Netscape draft. |
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 the cookie attribute and update the corresponsing Cookie
properties as defined by the Netscape draft specification |
void |
validate(String host,
int port,
String path,
boolean secure,
Cookie cookie)
Performs Netscape draft compliant Cookie validation |
Methods inherited from class org.apache.commons.httpclient.cookie.CookieSpecBase |
---|
formatCookie, formatCookieHeader, formatCookieHeader, formatCookies, getValidDateFormats, match, match, parse, pathMatch, setValidDateFormats |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NetscapeDraftSpec()
Method Detail |
---|
public Cookie[] parse(String host, int port, String path, boolean secure, String header) throws MalformedCookieException
Syntax of the Set-Cookie HTTP Response Header:
This is the format a CGI script would use to add to the HTTP headers a new piece of data which is to be stored by the client for later retrieval.
Set-Cookie: NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN_NAME; secure
Please note that Netscape draft specification does not fully conform to the HTTP header format. Netscape draft does not specify whether multiple cookies may be sent in one header. Hence, comma character may be present in unquoted cookie value or unquoted parameter value.
parse
in interface CookieSpec
parse
in class CookieSpecBase
host
- 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 void parseAttribute(NameValuePair attribute, Cookie cookie) throws MalformedCookieException
Cookie
properties as defined by the Netscape draft specification
parseAttribute
in interface CookieSpec
parseAttribute
in class CookieSpecBase
attribute
- NameValuePair
cookie attribute from the
Set- Cookiecookie
- Cookie
to be updated
MalformedCookieException
- if an exception occurs during parsingpublic boolean domainMatch(String host, String domain)
domainMatch
in interface CookieSpec
domainMatch
in class CookieSpecBase
host
- The target host.domain
- The cookie domain attribute.
public void validate(String host, int port, String path, boolean secure, Cookie cookie) throws MalformedCookieException
Cookie
validation
validate
in interface CookieSpec
validate
in class CookieSpecBase
host
- 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |