org.apache.http.impl.cookie
Class NetscapeDraftSpecHC4

java.lang.Object
  extended by org.apache.http.impl.cookie.AbstractCookieSpecHC4
      extended by org.apache.http.impl.cookie.CookieSpecBaseHC4
          extended by org.apache.http.impl.cookie.NetscapeDraftSpecHC4
All Implemented Interfaces:
org.apache.http.cookie.CookieSpec

@NotThreadSafe
public class NetscapeDraftSpecHC4
extends CookieSpecBaseHC4

This CookieSpec implementation conforms to the original draft specification published by Netscape Communications. It should be avoided unless absolutely necessary for compatibility with legacy applications.

Since:
4.0

Field Summary
protected static java.lang.String EXPIRES_PATTERN
           
 
Constructor Summary
NetscapeDraftSpecHC4()
          Default constructor
NetscapeDraftSpecHC4(java.lang.String[] datepatterns)
          Default constructor
 
Method Summary
 java.util.List<org.apache.http.Header> formatCookies(java.util.List<org.apache.http.cookie.Cookie> cookies)
           
 int getVersion()
           
 org.apache.http.Header getVersionHeader()
           
 java.util.List<org.apache.http.cookie.Cookie> parse(org.apache.http.Header header, org.apache.http.cookie.CookieOrigin origin)
          Parses the Set-Cookie value into an array of Cookies.
 java.lang.String toString()
           
 
Methods inherited from class org.apache.http.impl.cookie.CookieSpecBaseHC4
getDefaultDomain, getDefaultPath, match, parse, validate
 
Methods inherited from class org.apache.http.impl.cookie.AbstractCookieSpecHC4
findAttribHandler, getAttribHandler, getAttribHandlers, registerAttribHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXPIRES_PATTERN

protected static final java.lang.String EXPIRES_PATTERN
See Also:
Constant Field Values
Constructor Detail

NetscapeDraftSpecHC4

public NetscapeDraftSpecHC4(java.lang.String[] datepatterns)
Default constructor


NetscapeDraftSpecHC4

public NetscapeDraftSpecHC4()
Default constructor

Method Detail

parse

public java.util.List<org.apache.http.cookie.Cookie> parse(org.apache.http.Header header,
                                                           org.apache.http.cookie.CookieOrigin origin)
                                                    throws org.apache.http.cookie.MalformedCookieException
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 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 - the Set-Cookie received from the server
Returns:
an array of Cookies parsed from the Set-Cookie value
Throws:
org.apache.http.cookie.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<org.apache.http.cookie.Cookie> cookies)

getVersion

public int getVersion()

getVersionHeader

public org.apache.http.Header getVersionHeader()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object