Package org.apache.http.impl.cookie
Class NetscapeDraftSpec
java.lang.Object
org.apache.http.impl.cookie.AbstractCookieSpec
org.apache.http.impl.cookie.CookieSpecBase
org.apache.http.impl.cookie.NetscapeDraftSpec
- All Implemented Interfaces:
CookieSpec
public class NetscapeDraftSpec extends CookieSpecBase
Netscape cookie draft compliant cookie policy
- Since:
- 4.0
- Author:
- B.C. Holmes, Park, Sung-Gu, Doug Sale, Rod Waldhoff, dIon Gillard, Sean C. Sullivan, John Evans, Marc A. Saegesser, Oleg Kalnichevski, Mike Bowler
-
Field Summary
Fields Modifier and Type Field Description protected static StringEXPIRES_PATTERN -
Constructor Summary
Constructors Constructor Description NetscapeDraftSpec()Default constructorNetscapeDraftSpec(String[] datepatterns)Default constructor -
Method Summary
Modifier and Type Method Description List<Header>formatCookies(List<Cookie> cookies)Create "Cookie" headers for an array of Cookies.intgetVersion()Returns version of the state management this cookie specification conforms to.HeadergetVersionHeader()Returns a request header identifying what version of the state management specification is understood.List<Cookie>parse(Header header, CookieOrigin origin)Parses the Set-Cookie value into an array of Cookies.Methods inherited from class org.apache.http.impl.cookie.CookieSpecBase
getDefaultDomain, getDefaultPath, match, parse, validateMethods inherited from class org.apache.http.impl.cookie.AbstractCookieSpec
findAttribHandler, getAttribHandler, getAttribHandlers, registerAttribHandler
-
Field Details
-
EXPIRES_PATTERN
- See Also:
- Constant Field Values
-
-
Constructor Details
-
NetscapeDraftSpec
Default constructor -
NetscapeDraftSpec
public NetscapeDraftSpec()Default constructor
-
-
Method Details
-
parse
Parses the Set-Cookie value into an array of Cookies.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.
- Parameters:
header- the Set-Cookie received from the serverorigin- details of the cookie origin- Returns:
- an array of Cookies parsed from the Set-Cookie value
- Throws:
MalformedCookieException- if an exception occurs during parsing- See Also:
- The Cookie Spec.
-
formatCookies
Description copied from interface:CookieSpecCreate "Cookie" headers for an array of Cookies.- Parameters:
cookies- the Cookies format into a Cookie header- Returns:
- a Header for the given Cookies.
-
getVersion
public int getVersion()Description copied from interface:CookieSpecReturns version of the state management this cookie specification conforms to.- Returns:
- version of the state management specification
-
getVersionHeader
Description copied from interface:CookieSpecReturns a request header identifying what version of the state management specification is understood. May benullif the cookie specification does not support Cookie2 header.
-