Return-Path: Delivered-To: apmail-jakarta-httpclient-commits-archive@www.apache.org Received: (qmail 57062 invoked from network); 7 May 2006 20:31:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 May 2006 20:31:05 -0000 Received: (qmail 53049 invoked by uid 500); 7 May 2006 20:31:04 -0000 Mailing-List: contact httpclient-commits-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: httpclient-dev@jakarta.apache.org Delivered-To: mailing list httpclient-commits@jakarta.apache.org Received: (qmail 53038 invoked by uid 99); 7 May 2006 20:31:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 May 2006 13:31:04 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 07 May 2006 13:31:03 -0700 Received: (qmail 56973 invoked by uid 65534); 7 May 2006 20:30:43 -0000 Message-ID: <20060507203043.56972.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r404843 - /jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/CookieSpec.java Date: Sun, 07 May 2006 20:30:43 -0000 To: httpclient-commits@jakarta.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: olegk Date: Sun May 7 13:30:41 2006 New Revision: 404843 URL: http://svn.apache.org/viewcvs?rev=404843&view=rev Log: Simplified CookieSpec API (the first take) Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/CookieSpec.java Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/CookieSpec.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/CookieSpec.java?rev=404843&r1=404842&r2=404843&view=diff ============================================================================== --- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/CookieSpec.java (original) +++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/CookieSpec.java Sun May 7 13:30:41 2006 @@ -29,8 +29,6 @@ package org.apache.http.cookie; -import java.util.Collection; - import org.apache.http.Header; /** @@ -43,41 +41,13 @@ * * for a given host, port and path of origin * - * @author Oleg Kalnichevski + * @author Oleg Kalnichevski * @author Jeff Dever * * @since 2.0 */ public interface CookieSpec { - /** Path delimiter */ - static final String PATH_DELIM = "/"; - - /** Path delimiting charachter */ - static final char PATH_DELIM_CHAR = PATH_DELIM.charAt(0); - - /** - * Parse the "Set-Cookie" header value into Cookie array. - * - *

This method will not perform the validation of the resultant - * {@link Cookie}s

- * - * @see #validate(String, int, String, boolean, Cookie) - * - * @param host the host which sent the Set-Cookie header - * @param port the port which sent the Set-Cookie header - * @param path the path which sent the Set-Cookie header - * @param secure true when the Set-Cookie header - * was received over secure conection - * @param header the Set-Cookie received from the server - * @return an array of Cookies parsed from the Set-Cookie value - * @throws MalformedCookieException if an exception occurs during parsing - * @throws IllegalArgumentException if an input parameter is illegal - */ - Cookie[] parse(String host, int port, String path, boolean secure, - final String header) - throws MalformedCookieException, IllegalArgumentException; - /** * Parse the "Set-Cookie" Header into an array of Cookies. * @@ -86,118 +56,41 @@ * * @see #validate(String, int, String, boolean, Cookie) * - * @param host the host which sent the Set-Cookie header - * @param port the port which sent the Set-Cookie header - * @param path the path which sent the Set-Cookie header - * @param secure true when the Set-Cookie header - * was received over secure conection * @param header the Set-Cookie received from the server + * @param origin details of the cookie origin * @return an array of Cookies parsed from the header * @throws MalformedCookieException if an exception occurs during parsing - * @throws IllegalArgumentException if an input parameter is illegal */ - Cookie[] parse(String host, int port, String path, boolean secure, - final Header header) - throws MalformedCookieException, IllegalArgumentException; + Cookie[] parse(Header header, CookieOrigin origin) throws MalformedCookieException; /** * Validate the cookie according to validation rules defined by the * cookie specification. * - * @param host the host from which the {@link Cookie} was received - * @param port the port from which the {@link Cookie} was received - * @param path the path from which the {@link Cookie} was received - * @param secure true when the {@link Cookie} was received - * using a secure connection * @param cookie the Cookie to validate + * @param origin details of the cookie origin * @throws MalformedCookieException if the cookie is invalid - * @throws IllegalArgumentException if an input parameter is illegal */ - void validate(String host, int port, String path, boolean secure, - final Cookie cookie) - throws MalformedCookieException, IllegalArgumentException; - - - /** - * Sets the {@link Collection} of date patterns used for parsing. The String patterns must be - * compatible with {@link java.text.SimpleDateFormat}. - * - * @param datepatterns collection of date patterns - */ - void setValidDateFormats(Collection datepatterns); - - /** - * Returns the {@link Collection} of date patterns used for parsing. The String patterns are compatible - * with the {@link java.text.SimpleDateFormat}. - * - * @return collection of date patterns - */ - Collection getValidDateFormats(); + void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException; /** - * Determines if a Cookie matches a location. + * Determines if a Cookie matches the target location. * - * @param host the host to which the request is being submitted - * @param port the port to which the request is being submitted - * @param path the path to which the request is being submitted - * @param secure true if the request is using a secure connection * @param cookie the Cookie to be matched - * + * @param origin the target to test against + * * @return true if the cookie should be submitted with a request * with given attributes, false otherwise. */ - boolean match(String host, int port, String path, boolean secure, - final Cookie cookie); - - /** - * Determines which of an array of Cookies matches a location. - * - * @param host the host to which the request is being submitted - * @param port the port to which the request is being submitted - * (currenlty ignored) - * @param path the path to which the request is being submitted - * @param secure true if the request is using a secure protocol - * @param cookies an array of Cookies to be matched - * - * @return true if the cookie should be submitted with a request - * with given attributes, false otherwise. - */ - Cookie[] match(String host, int port, String path, boolean secure, - final Cookie cookies[]); - - /** - * Create a "Cookie" header value for an array of cookies. - * - * @param cookie the cookie to be formatted as string - * @return a string suitable for sending in a "Cookie" header. - */ - String formatCookie(Cookie cookie); + boolean match(Cookie cookie, CookieOrigin origin); /** - * Create a "Cookie" header value for an array of cookies. - * - * @param cookies the Cookies to be formatted - * @return a string suitable for sending in a Cookie header. - * @throws IllegalArgumentException if an input parameter is illegal - */ - String formatCookies(Cookie[] cookies) throws IllegalArgumentException; - - /** - * Create a "Cookie" Header for an array of Cookies. + * Create "Cookie" headers for an array of Cookies. * * @param cookies the Cookies format into a Cookie header * @return a Header for the given Cookies. * @throws IllegalArgumentException if an input parameter is illegal */ - Header formatCookieHeader(Cookie[] cookies) throws IllegalArgumentException; - - /** - * Create a "Cookie" Header for single Cookie. - * - * @param cookie the Cookie format as a Cookie header - * @return a Cookie header. - * @throws IllegalArgumentException if an input parameter is illegal - */ - Header formatCookieHeader(Cookie cookie) throws IllegalArgumentException; + Header[] formatCookies(Cookie[] cookies); }