org.apache.commons.httpclient.cookie

Class RFC2109Spec

public class RFC2109Spec extends CookieSpecBase

RFC 2109 specific cookie management functions

Since: 2.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
static StringSET_COOKIE_KEY
Cookie Response Header name for cookies processed by this spec.
Constructor Summary
RFC2109Spec()
Default constructor
Method Summary
booleandomainMatch(String host, String domain)
Performs domain-match as defined by the RFC2109.
StringformatCookie(Cookie cookie)
Return a string suitable for sending in a "Cookie" header as defined in RFC 2109
StringformatCookies(Cookie[] cookies)
Create a RFC 2109 compliant "Cookie" header value containing all Cookies in cookies suitable for sending in a "Cookie" header
voidparseAttribute(NameValuePair attribute, Cookie cookie)
Parse RFC 2109 specific cookie attribute and update the corresponsing Cookie properties.
voidvalidate(String host, int port, String path, boolean secure, Cookie cookie)
Performs RFC 2109 compliant Cookie validation

Field Detail

SET_COOKIE_KEY

public static final String SET_COOKIE_KEY
Cookie Response Header name for cookies processed by this spec.

Constructor Detail

RFC2109Spec

public RFC2109Spec()
Default constructor

Method Detail

domainMatch

public boolean domainMatch(String host, String domain)
Performs domain-match as defined by the RFC2109.

Parameters: host The target host. domain The cookie domain attribute.

Returns: true if the specified host matches the given domain.

Since: 3.0

formatCookie

public String formatCookie(Cookie cookie)
Return a string suitable for sending in a "Cookie" header as defined in RFC 2109

Parameters: cookie a Cookie to be formatted as string

Returns: a string suitable for sending in a "Cookie" header.

formatCookies

public String formatCookies(Cookie[] cookies)
Create a RFC 2109 compliant "Cookie" header value containing all Cookies in cookies suitable for sending in a "Cookie" header

Parameters: cookies an array of Cookies to be formatted

Returns: a string suitable for sending in a Cookie header.

parseAttribute

public void parseAttribute(NameValuePair attribute, Cookie cookie)
Parse RFC 2109 specific cookie attribute and update the corresponsing Cookie properties.

Parameters: attribute NameValuePair cookie attribute from the Set- Cookie cookie Cookie to be updated

Throws: MalformedCookieException if an exception occurs during parsing

validate

public void validate(String host, int port, String path, boolean secure, Cookie cookie)
Performs RFC 2109 compliant Cookie validation

Parameters: host the host from which the Cookie was received port the port from which the Cookie was received path the path from which the Cookie was received secure true when the Cookie was received using a secure connection cookie The cookie to validate

Throws: MalformedCookieException if an exception occurs during validation

Copyright (c) 1999-2005 - Apache Software Foundation