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
@Obsolete @Contract(threading=SAFE) public class NetscapeDraftSpec extends CookieSpecBase
ThisCookieSpec
implementation conforms to the original draft specification published by Netscape Communications. It should be avoided unless absolutely necessary for compatibility with legacy applications.Rendered obsolete by
RFC6265LaxSpec
.- Since:
- 4.0
- See Also:
RFC6265LaxSpec
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
EXPIRES_PATTERN
-
Constructor Summary
Constructors Constructor Description NetscapeDraftSpec()
NetscapeDraftSpec(java.lang.String[] datepatterns)
Default constructorNetscapeDraftSpec(CommonCookieAttributeHandler... handlers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<org.apache.http.Header>
formatCookies(java.util.List<Cookie> cookies)
Create"Cookie"
headers for an array of Cookies.int
getVersion()
Returns version of the state management this cookie specification conforms to.org.apache.http.Header
getVersionHeader()
Returns a request header identifying what version of the state management specification is understood.java.util.List<Cookie>
parse(org.apache.http.Header header, CookieOrigin origin)
Parses the Set-Cookie value into an array ofCookie
s.java.lang.String
toString()
-
Methods inherited from class org.apache.http.impl.cookie.CookieSpecBase
getDefaultDomain, getDefaultPath, match, parse, validate
-
Methods inherited from class org.apache.http.impl.cookie.AbstractCookieSpec
findAttribHandler, getAttribHandler, getAttribHandlers, registerAttribHandler
-
-
-
-
Field Detail
-
EXPIRES_PATTERN
protected static final java.lang.String EXPIRES_PATTERN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NetscapeDraftSpec
public NetscapeDraftSpec(java.lang.String[] datepatterns)
Default constructor
-
NetscapeDraftSpec
NetscapeDraftSpec(CommonCookieAttributeHandler... handlers)
-
NetscapeDraftSpec
public NetscapeDraftSpec()
-
-
Method Detail
-
parse
public java.util.List<Cookie> parse(org.apache.http.Header header, CookieOrigin origin) throws MalformedCookieException
Parses the Set-Cookie value into an array ofCookie
s.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 the Netscape draft specification does not fully conform to the HTTP header format. Comma character if present in
Set-Cookie
will not be treated as a header element separator- Parameters:
header
- theSet-Cookie
received from the serverorigin
- details of the cookie origin- Returns:
- an array of
Cookie
s parsed from the Set-Cookie value - Throws:
MalformedCookieException
- if an exception occurs during parsing- See Also:
- The Cookie Spec.
-
formatCookies
public java.util.List<org.apache.http.Header> formatCookies(java.util.List<Cookie> cookies)
Description copied from interface:CookieSpec
Create"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:CookieSpec
Returns version of the state management this cookie specification conforms to.- Returns:
- version of the state management specification
-
getVersionHeader
public org.apache.http.Header getVersionHeader()
Description copied from interface:CookieSpec
Returns a request header identifying what version of the state management specification is understood. May benull
if the cookie specification does not supportCookie2
header.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-