You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2006/04/30 13:58:32 UTC

svn commit: r398319 - in /jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie: CookieAttributeHandler.java CookieOrigin.java CookieSource.java RFC2965Spec.java

Author: olegk
Date: Sun Apr 30 04:58:30 2006
New Revision: 398319

URL: http://svn.apache.org/viewcvs?rev=398319&view=rev
Log:
Renamed CookieSource to CookieOrigin

Added:
    jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieOrigin.java
      - copied, changed from r396994, jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieSource.java
Removed:
    jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieSource.java
Modified:
    jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java
    jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/RFC2965Spec.java

Modified: jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java?rev=398319&r1=398318&r2=398319&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java (original)
+++ jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieAttributeHandler.java Sun Apr 30 04:58:30 2006
@@ -57,10 +57,10 @@
    * Peforms cookie validation for the given attribute value.
    *
    * @param cookie {@link org.apache.commons.httpclient.Cookie} to validate
-   * @param source the cookie source to validate against
+   * @param origin the cookie source to validate against
    * @throws MalformedCookieException if cookie validation fails for this attribute
    */
-  void validate(Cookie cookie, CookieSource source)
+  void validate(Cookie cookie, CookieOrigin origin)
           throws MalformedCookieException;
 
   /**
@@ -68,9 +68,9 @@
    * submitted) with the corresponding cookie attribute.
    *
    * @param cookie {@link org.apache.commons.httpclient.Cookie} to match
-   * @param source the cookie source to match against
+   * @param origin the cookie source to match against
    * @return <tt>true</tt> if the match is successful; <tt>false</tt> otherwise
    */
-  boolean match(Cookie cookie, CookieSource source);
+  boolean match(Cookie cookie, CookieOrigin origin);
 
 }

Copied: jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieOrigin.java (from r396994, jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieSource.java)
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieOrigin.java?p2=jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieOrigin.java&p1=jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieSource.java&r1=396994&r2=398319&rev=398319&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieSource.java (original)
+++ jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/CookieOrigin.java Sun Apr 30 04:58:30 2006
@@ -28,14 +28,14 @@
  */
 package org.apache.commons.httpclient.cookie;
 
-public final class CookieSource {
+public final class CookieOrigin {
 
 	private final String host;
 	private final int port;
 	private final String path;
 	private final boolean secure;
 	
-	public CookieSource(final String host, int port, final String path, boolean secure) {
+	public CookieOrigin(final String host, int port, final String path, boolean secure) {
 		super();
         if (host == null) {
             throw new IllegalArgumentException(

Modified: jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/RFC2965Spec.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/RFC2965Spec.java?rev=398319&r1=398318&r2=398319&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/RFC2965Spec.java (original)
+++ jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/java/org/apache/commons/httpclient/cookie/RFC2965Spec.java Sun Apr 30 04:58:30 2006
@@ -349,10 +349,10 @@
             if (cookie.getName().startsWith("$")) {
                 throw new MalformedCookieException("Cookie name may not start with $");
             }
-            CookieSource cookiesource = new CookieSource(host, port, path, secure); 
+            CookieOrigin origin = new CookieOrigin(host, port, path, secure); 
             for (Iterator i = getAttribHandlerIterator(); i.hasNext(); ) {
               CookieAttributeHandler handler = (CookieAttributeHandler) i.next();
-              handler.validate(cookie, cookiesource);
+              handler.validate(cookie, origin);
             }
         } else {
             // old-style cookies are validated according to the old rules
@@ -383,10 +383,10 @@
             if (cookie.isPersistent() && cookie.isExpired()) {
                 return false;
             }
-            CookieSource cookiesource = new CookieSource(host, port, path, secure); 
+            CookieOrigin origin = new CookieOrigin(host, port, path, secure); 
             for (Iterator i = getAttribHandlerIterator(); i.hasNext(); ) {
                 CookieAttributeHandler handler = (CookieAttributeHandler) i.next();
-                if (!handler.match(cookie, cookiesource)) {
+                if (!handler.match(cookie, origin)) {
                     return false;
                 }
             }
@@ -604,7 +604,6 @@
 
         /**
          * Parse cookie path attribute.
-         * @see CookieAttributeHandler#parse(org.apache.commons.httpclient.Cookie, String)
          */
         public void parse(final Cookie cookie, final String path)
                 throws MalformedCookieException {
@@ -628,17 +627,16 @@
         /**
          * Validate cookie path attribute. The value for the Path attribute must be a
          * prefix of the request-URI (case-sensitive matching).
-         * @see CookieAttributeHandler#validate(org.apache.commons.httpclient.Cookie, String)
          */
-        public void validate(final Cookie cookie, final CookieSource source)
+        public void validate(final Cookie cookie, final CookieOrigin origin)
                 throws MalformedCookieException {
             if (cookie == null) {
                 throw new IllegalArgumentException("Cookie may not be null");
             }
-            if (source == null) {
-                throw new IllegalArgumentException("Cookie source may not be null");
+            if (origin == null) {
+                throw new IllegalArgumentException("Cookie origin may not be null");
             }
-            String path = source.getPath();
+            String path = origin.getPath();
             if (path == null) {
                 throw new IllegalArgumentException(
                         "Path of origin host may not be null.");
@@ -661,16 +659,15 @@
         /**
          * Match cookie path attribute. The value for the Path attribute must be a
          * prefix of the request-URI (case-sensitive matching).
-         * @see CookieAttributeHandler#match(org.apache.commons.httpclient.Cookie, String)
          */
-        public boolean match(final Cookie cookie, final CookieSource source) {
+        public boolean match(final Cookie cookie, final CookieOrigin origin) {
             if (cookie == null) {
                 throw new IllegalArgumentException("Cookie may not be null");
             }
-            if (source == null) {
-                throw new IllegalArgumentException("Cookie source may not be null");
+            if (origin == null) {
+                throw new IllegalArgumentException("Cookie origin may not be null");
             }
-            String path = source.getPath();
+            String path = origin.getPath();
             if (cookie.getPath() == null) {
                 LOG.warn("Invalid cookie state: path attribute is null.");
                 return false;
@@ -694,7 +691,6 @@
 
         /**
          * Parse cookie domain attribute.
-         * @see CookieAttributeHandler#parse(org.apache.commons.httpclient.Cookie, String)
          */
         public void parse(final Cookie cookie, String domain)
                 throws MalformedCookieException {
@@ -722,17 +718,16 @@
 
         /**
          * Validate cookie domain attribute.
-         * @see CookieAttributeHandler#validate(org.apache.commons.httpclient.Cookie, String)
          */
-        public void validate(final Cookie cookie, final CookieSource source)
+        public void validate(final Cookie cookie, final CookieOrigin origin)
                 throws MalformedCookieException {
             if (cookie == null) {
                 throw new IllegalArgumentException("Cookie may not be null");
             }
-            if (source == null) {
-                throw new IllegalArgumentException("Cookie source may not be null");
+            if (origin == null) {
+                throw new IllegalArgumentException("Cookie origin may not be null");
             }
-            String host = source.getHost().toLowerCase();
+            String host = origin.getHost().toLowerCase();
             if (cookie.getDomain() == null) {
                 throw new MalformedCookieException("Invalid cookie state: " +
                                                    "domain not specified");
@@ -789,16 +784,15 @@
 
         /**
          * Match cookie domain attribute.
-         * @see CookieAttributeHandler#match(org.apache.commons.httpclient.Cookie, String)
          */
-        public boolean match(final Cookie cookie, final CookieSource source) {
+        public boolean match(final Cookie cookie, final CookieOrigin origin) {
             if (cookie == null) {
                 throw new IllegalArgumentException("Cookie may not be null");
             }
-            if (source == null) {
-                throw new IllegalArgumentException("Cookie source may not be null");
+            if (origin == null) {
+                throw new IllegalArgumentException("Cookie origin may not be null");
             }
-            String host = source.getHost().toLowerCase();
+            String host = origin.getHost().toLowerCase();
             String cookieDomain = cookie.getDomain();
             String effectiveHost = getEffectiveHost(host);
 
@@ -827,7 +821,6 @@
 
         /**
          * Parse cookie port attribute.
-         * @see CookieAttributeHandler#parse(org.apache.commons.httpclient.Cookie, String)
          */
         public void parse(final Cookie cookie, final String portValue)
                 throws MalformedCookieException {
@@ -855,19 +848,18 @@
         /**
          * Validate cookie port attribute. If the Port attribute was specified
          * in header, the request port must be in cookie's port list.
-         * @see CookieAttributeHandler#validate(org.apache.commons.httpclient.Cookie, String)
          */
-        public void validate(final Cookie cookie, final CookieSource source)
+        public void validate(final Cookie cookie, final CookieOrigin origin)
                 throws MalformedCookieException {
             if (cookie == null) {
                 throw new IllegalArgumentException("Cookie may not be null");
             }
-            if (source == null) {
-                throw new IllegalArgumentException("Cookie source may not be null");
+            if (origin == null) {
+                throw new IllegalArgumentException("Cookie origin may not be null");
             }
             if (cookie instanceof Cookie2) {
                 Cookie2 cookie2 = (Cookie2) cookie;
-                int port = source.getPort();
+                int port = origin.getPort();
                 if (cookie2.isPortAttributeSpecified()) {
                     if (!portMatch(port, cookie2.getPorts())) {
                         throw new MalformedCookieException(
@@ -882,18 +874,17 @@
          * Match cookie port attribute. If the Port attribute is not specified
          * in header, the cookie can be sent to any port. Otherwise, the request port
          * must be in the cookie's port list.
-         * @see CookieAttributeHandler#match(org.apache.commons.httpclient.Cookie, String)
          */
-        public boolean match(final Cookie cookie, final CookieSource source) {
+        public boolean match(final Cookie cookie, final CookieOrigin origin) {
             if (cookie == null) {
                 throw new IllegalArgumentException("Cookie may not be null");
             }
-            if (source == null) {
-                throw new IllegalArgumentException("Cookie source may not be null");
+            if (origin == null) {
+                throw new IllegalArgumentException("Cookie origin may not be null");
             }
             if (cookie instanceof Cookie2) {
                 Cookie2 cookie2 = (Cookie2) cookie;
-                int port = source.getPort();
+                int port = origin.getPort();
                 if (cookie2.isPortAttributeSpecified()) {
                     if (cookie2.getPorts() == null) {
                         LOG.warn("Invalid cookie state: port not specified");
@@ -918,7 +909,6 @@
 
       /**
        * Parse cookie max-age attribute.
-       * @see CookieAttributeHandler#parse(org.apache.commons.httpclient.Cookie, String)
        */
       public void parse(final Cookie cookie, final String value)
               throws MalformedCookieException {
@@ -946,15 +936,14 @@
 
       /**
        * validate cookie max-age attribute.
-       * @see CookieAttributeHandler#validate(org.apache.commons.httpclient.Cookie, String)
        */
-      public void validate(final Cookie cookieParam, final CookieSource source) {
+      public void validate(final Cookie cookieParam, final CookieOrigin origin) {
       }
 
       /**
        * @see CookieAttributeHandler#match(org.apache.commons.httpclient.Cookie, String)
        */
-      public boolean match(final Cookie cookieParam, final CookieSource source) {
+      public boolean match(final Cookie cookieParam, final CookieOrigin origin) {
           return true;
       }
 
@@ -971,21 +960,18 @@
           cookie.setSecure(true);
       }
 
-      public void validate(final Cookie cookie, final CookieSource source)
+      public void validate(final Cookie cookie, final CookieOrigin origin)
               throws MalformedCookieException {
       }
 
-      /**
-       * @see CookieAttributeHandler#match(org.apache.commons.httpclient.Cookie, String)
-       */
-      public boolean match(final Cookie cookie, final CookieSource source) {
+      public boolean match(final Cookie cookie, final CookieOrigin origin) {
           if (cookie == null) {
               throw new IllegalArgumentException("Cookie may not be null");
           }
-          if (source == null) {
-              throw new IllegalArgumentException("Cookie source may not be null");
+          if (origin == null) {
+              throw new IllegalArgumentException("Cookie origin may not be null");
           }
-          return cookie.getSecure() == source.isSecure();
+          return cookie.getSecure() == origin.isSecure();
       }
       
   }
@@ -998,7 +984,6 @@
 
         /**
          * Parse cookie version attribute.
-         * @see CookieAttributeHandler#parse(org.apache.commons.httpclient.Cookie, String)
          */
         public void parse(final Cookie cookie, final String value)
                 throws MalformedCookieException {
@@ -1029,9 +1014,8 @@
 
         /**
          * validate cookie version attribute. Version attribute is REQUIRED.
-         * @see CookieAttributeHandler#validate(org.apache.commons.httpclient.Cookie, String)
          */
-        public void validate(final Cookie cookie, final CookieSource source)
+        public void validate(final Cookie cookie, final CookieOrigin origin)
                 throws MalformedCookieException {
             if (cookie == null) {
                 throw new IllegalArgumentException("Cookie may not be null");
@@ -1051,10 +1035,7 @@
             }
         }
 
-        /**
-         * @see CookieAttributeHandler#match(org.apache.commons.httpclient.Cookie, String)
-         */
-        public boolean match(final Cookie cookieParam, final CookieSource source) {
+        public boolean match(final Cookie cookieParam, final CookieOrigin origin) {
             return true;
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org