org.apache.http.cookie
Interface CookieSpec

All Known Implementing Classes:
AbstractCookieSpec, BrowserCompatSpec, CookieSpecBase, NetscapeDraftSpec, RFC2109Spec

public interface CookieSpec

Defines the cookie management specification.

Cookie management specification must define

for a given host, port and path of origin

Since:
4.0
Author:
Oleg Kalnichevski, Jeff Dever

Method Summary
 org.apache.http.Header[] formatCookies(Cookie[] cookies)
          Create "Cookie" headers for an array of Cookies.
 boolean match(Cookie cookie, CookieOrigin origin)
          Determines if a Cookie matches the target location.
 Cookie[] parse(org.apache.http.Header header, CookieOrigin origin)
          Parse the "Set-Cookie" Header into an array of Cookies.
 void validate(Cookie cookie, CookieOrigin origin)
          Validate the cookie according to validation rules defined by the cookie specification.
 

Method Detail

parse

Cookie[] parse(org.apache.http.Header header,
               CookieOrigin origin)
               throws MalformedCookieException
Parse the "Set-Cookie" Header into an array of Cookies.

This method will not perform the validation of the resultant Cookies

Parameters:
header - the Set-Cookie received from the server
origin - details of the cookie origin
Returns:
an array of Cookies parsed from the header
Throws:
MalformedCookieException - if an exception occurs during parsing
See Also:
validate(org.apache.http.cookie.Cookie, org.apache.http.cookie.CookieOrigin)

validate

void validate(Cookie cookie,
              CookieOrigin origin)
              throws MalformedCookieException
Validate the cookie according to validation rules defined by the cookie specification.

Parameters:
cookie - the Cookie to validate
origin - details of the cookie origin
Throws:
MalformedCookieException - if the cookie is invalid

match

boolean match(Cookie cookie,
              CookieOrigin origin)
Determines if a Cookie matches the target location.

Parameters:
cookie - the Cookie to be matched
origin - the target to test against
Returns:
true if the cookie should be submitted with a request with given attributes, false otherwise.

formatCookies

org.apache.http.Header[] formatCookies(Cookie[] cookies)
Create "Cookie" headers for an array of Cookies.

Parameters:
cookies - the Cookies format into a Cookie header
Returns:
a Header for the given Cookies.
Throws:
java.lang.IllegalArgumentException - if an input parameter is illegal


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.