Android APIs
Added in API level 1
Deprecated since API level 22
public class

NetscapeDraftSpec

extends CookieSpecBase
java.lang.Object
   ↳ org.apache.http.impl.cookie.AbstractCookieSpec
     ↳ org.apache.http.impl.cookie.CookieSpecBase
       ↳ org.apache.http.impl.cookie.NetscapeDraftSpec

This class was deprecated in API level 22.
Please use openConnection() instead. Please visit this webpage for further details.

Class Overview

Netscape cookie draft compliant cookie policy

Summary

Constants
String EXPIRES_PATTERN
Public Constructors
NetscapeDraftSpec(String[] datepatterns)
Default constructor
NetscapeDraftSpec()
Default constructor
Public Methods
List<Header> formatCookies(List<Cookie> cookies)
int getVersion()
Header getVersionHeader()
List<Cookie> parse(Header header, CookieOrigin origin)
Parses the Set-Cookie value into an array of Cookies.
[Expand]
Inherited Methods
From class org.apache.http.impl.cookie.CookieSpecBase
From class org.apache.http.impl.cookie.AbstractCookieSpec
From class java.lang.Object
From interface org.apache.http.cookie.CookieSpec

Constants

protected static final String EXPIRES_PATTERN

Added in API level 1

Constant Value: "EEE, dd-MMM-yyyy HH:mm:ss z"

Public Constructors

public NetscapeDraftSpec (String[] datepatterns)

Added in API level 1

Default constructor

public NetscapeDraftSpec ()

Added in API level 1

Default constructor

Public Methods

public List<Header> formatCookies (List<Cookie> cookies)

Added in API level 1

public int getVersion ()

Added in API level 1

public Header getVersionHeader ()

Added in API level 1

public List<Cookie> parse (Header header, CookieOrigin origin)

Added in API level 1

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 server
Returns
  • an array of Cookies parsed from the Set-Cookie value
Throws
MalformedCookieException if an exception occurs during parsing