diff --git a/module-client/src/main/java/org/apache/http/impl/cookie/BasicCookie.java b/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java similarity index 98% rename from module-client/src/main/java/org/apache/http/impl/cookie/BasicCookie.java rename to module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java index 69ff19288..7168ff67c 100644 --- a/module-client/src/main/java/org/apache/http/impl/cookie/BasicCookie.java +++ b/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java @@ -57,7 +57,7 @@ import org.apache.http.util.CharArrayBuffer; * * @version $Revision$ */ -public class BasicCookie implements SetCookie, ClientCookie { +public class BasicClientCookie implements SetCookie, ClientCookie { /** * Default Constructor taking a name and a value. The value may be null. @@ -65,7 +65,7 @@ public class BasicCookie implements SetCookie, ClientCookie { * @param name The name. * @param value The value. */ - public BasicCookie(final String name, final String value) { + public BasicClientCookie(final String name, final String value) { super(); if (name == null) { throw new IllegalArgumentException("Name may not be null"); diff --git a/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie2.java b/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie2.java new file mode 100644 index 000000000..431fad75a --- /dev/null +++ b/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie2.java @@ -0,0 +1,75 @@ +/* + * $HeadURL$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + */ + +package org.apache.http.impl.cookie; + +import org.apache.http.cookie.SetCookie2; + +/** + * HTTP "magic-cookie" represents a piece of state information + * that the HTTP agent and the target server can exchange to maintain + * a session as specified by RFC2965. + * + * @author Oleg Kalnichevski + */ +public class BasicClientCookie2 extends BasicClientCookie implements SetCookie2 { + + private String commentURL; + private int[] ports; + + /** + * Default Constructor taking a name and a value. The value may be null. + * + * @param name The name. + * @param value The value. + */ + public BasicClientCookie2(final String name, final String value) { + super(name, value); + } + + public int[] getPorts() { + return this.ports; + } + + public void setPorts(final int[] ports) { + this.ports = ports; + } + + public String getCommentURL() { + return this.commentURL; + } + + public void setCommentURL(final String commentURL) { + this.commentURL = commentURL; + } + +} + diff --git a/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java b/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java index 04c61aa16..754bd9051 100644 --- a/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java +++ b/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java @@ -78,7 +78,7 @@ public abstract class CookieSpecBase extends AbstractCookieSpec { throw new MalformedCookieException("Cookie name may not be empty"); } - BasicCookie cookie = new BasicCookie(name, value); + BasicClientCookie cookie = new BasicClientCookie(name, value); cookie.setPath(getDefaultPath(origin)); cookie.setDomain(getDefaultDomain(origin)); diff --git a/module-client/src/test/java/org/apache/http/cookie/TestCookiePathComparator.java b/module-client/src/test/java/org/apache/http/cookie/TestCookiePathComparator.java index 71ee23d18..af0207a74 100644 --- a/module-client/src/test/java/org/apache/http/cookie/TestCookiePathComparator.java +++ b/module-client/src/test/java/org/apache/http/cookie/TestCookiePathComparator.java @@ -32,7 +32,7 @@ package org.apache.http.cookie; import java.util.Comparator; -import org.apache.http.impl.cookie.BasicCookie; +import org.apache.http.impl.cookie.BasicClientCookie; import junit.framework.Test; import junit.framework.TestCase; @@ -57,9 +57,9 @@ public class TestCookiePathComparator extends TestCase { } public void testUnequality1() { - BasicCookie cookie1 = new BasicCookie("name1", "value"); + BasicClientCookie cookie1 = new BasicClientCookie("name1", "value"); cookie1.setPath("/a/b/"); - BasicCookie cookie2 = new BasicCookie("name1", "value"); + BasicClientCookie cookie2 = new BasicClientCookie("name1", "value"); cookie2.setPath("/a/"); Comparator comparator = new CookiePathComparator(); assertTrue(comparator.compare(cookie1, cookie2) < 0); @@ -67,9 +67,9 @@ public class TestCookiePathComparator extends TestCase { } public void testUnequality2() { - BasicCookie cookie1 = new BasicCookie("name1", "value"); + BasicClientCookie cookie1 = new BasicClientCookie("name1", "value"); cookie1.setPath("/a/b"); - BasicCookie cookie2 = new BasicCookie("name1", "value"); + BasicClientCookie cookie2 = new BasicClientCookie("name1", "value"); cookie2.setPath("/a"); Comparator comparator = new CookiePathComparator(); assertTrue(comparator.compare(cookie1, cookie2) < 0); @@ -77,9 +77,9 @@ public class TestCookiePathComparator extends TestCase { } public void testEquality1() { - BasicCookie cookie1 = new BasicCookie("name1", "value"); + BasicClientCookie cookie1 = new BasicClientCookie("name1", "value"); cookie1.setPath("/a"); - BasicCookie cookie2 = new BasicCookie("name1", "value"); + BasicClientCookie cookie2 = new BasicClientCookie("name1", "value"); cookie2.setPath("/a"); Comparator comparator = new CookiePathComparator(); assertTrue(comparator.compare(cookie1, cookie2) == 0); @@ -87,9 +87,9 @@ public class TestCookiePathComparator extends TestCase { } public void testEquality2() { - BasicCookie cookie1 = new BasicCookie("name1", "value"); + BasicClientCookie cookie1 = new BasicClientCookie("name1", "value"); cookie1.setPath("/a/"); - BasicCookie cookie2 = new BasicCookie("name1", "value"); + BasicClientCookie cookie2 = new BasicClientCookie("name1", "value"); cookie2.setPath("/a"); Comparator comparator = new CookiePathComparator(); assertTrue(comparator.compare(cookie1, cookie2) == 0); @@ -97,9 +97,9 @@ public class TestCookiePathComparator extends TestCase { } public void testEquality3() { - BasicCookie cookie1 = new BasicCookie("name1", "value"); + BasicClientCookie cookie1 = new BasicClientCookie("name1", "value"); cookie1.setPath(null); - BasicCookie cookie2 = new BasicCookie("name1", "value"); + BasicClientCookie cookie2 = new BasicClientCookie("name1", "value"); cookie2.setPath("/"); Comparator comparator = new CookiePathComparator(); assertTrue(comparator.compare(cookie1, cookie2) == 0); @@ -107,9 +107,9 @@ public class TestCookiePathComparator extends TestCase { } public void testEquality4() { - BasicCookie cookie1 = new BasicCookie("name1", "value"); + BasicClientCookie cookie1 = new BasicClientCookie("name1", "value"); cookie1.setPath("/this"); - BasicCookie cookie2 = new BasicCookie("name1", "value"); + BasicClientCookie cookie2 = new BasicClientCookie("name1", "value"); cookie2.setPath("/that"); Comparator comparator = new CookiePathComparator(); assertTrue(comparator.compare(cookie1, cookie2) == 0); diff --git a/module-client/src/test/java/org/apache/http/impl/cookie/TestBasicCookieAttribHandlers.java b/module-client/src/test/java/org/apache/http/impl/cookie/TestBasicCookieAttribHandlers.java index cfcccfe91..b312bef32 100644 --- a/module-client/src/test/java/org/apache/http/impl/cookie/TestBasicCookieAttribHandlers.java +++ b/module-client/src/test/java/org/apache/http/impl/cookie/TestBasicCookieAttribHandlers.java @@ -60,14 +60,14 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicDomainParse() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicDomainHandler(); h.parse(cookie, "www.somedomain.com"); assertEquals("www.somedomain.com", cookie.getDomain()); } public void testBasicDomainParseInvalid() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicDomainHandler(); try { h.parse(cookie, ""); @@ -84,7 +84,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicDomainValidate1() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false); CookieAttributeHandler h = new BasicDomainHandler(); @@ -108,7 +108,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicDomainValidate2() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false); CookieAttributeHandler h = new BasicDomainHandler(); @@ -125,7 +125,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicDomainValidate3() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false); CookieAttributeHandler h = new BasicDomainHandler(); @@ -134,7 +134,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicDomainValidate4() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false); CookieAttributeHandler h = new BasicDomainHandler(); @@ -148,7 +148,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicDomainMatch1() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false); CookieAttributeHandler h = new BasicDomainHandler(); @@ -160,7 +160,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicDomainMatch2() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false); CookieAttributeHandler h = new BasicDomainHandler(); @@ -189,7 +189,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { // expected } try { - h.validate(new BasicCookie("name", "value"), null); + h.validate(new BasicClientCookie("name", "value"), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected @@ -201,7 +201,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { // expected } try { - h.match(new BasicCookie("name", "value"), null); + h.match(new BasicClientCookie("name", "value"), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected @@ -209,7 +209,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicPathParse() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicPathHandler(); h.parse(cookie, "stuff"); assertEquals("stuff", cookie.getPath()); @@ -220,7 +220,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicPathMatch1() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false); CookieAttributeHandler h = new BasicPathHandler(); cookie.setPath("/stuff"); @@ -228,7 +228,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicPathMatch2() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/", false); CookieAttributeHandler h = new BasicPathHandler(); cookie.setPath("/stuff"); @@ -236,7 +236,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicPathMatch3() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/more-stuff", false); CookieAttributeHandler h = new BasicPathHandler(); cookie.setPath("/stuff"); @@ -244,7 +244,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicPathMatch4() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuffed", false); CookieAttributeHandler h = new BasicPathHandler(); cookie.setPath("/stuff"); @@ -252,7 +252,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicPathMatch5() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/otherstuff", false); CookieAttributeHandler h = new BasicPathHandler(); cookie.setPath("/stuff"); @@ -260,7 +260,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicPathMatch6() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false); CookieAttributeHandler h = new BasicPathHandler(); cookie.setPath("/stuff/"); @@ -268,14 +268,14 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicPathMatch7() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false); CookieAttributeHandler h = new BasicPathHandler(); assertTrue(h.match(cookie, origin)); } public void testBasicPathValidate() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false); CookieAttributeHandler h = new BasicPathHandler(); cookie.setPath("/stuff"); @@ -304,7 +304,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { // expected } try { - h.match(new BasicCookie("name", "value"), null); + h.match(new BasicClientCookie("name", "value"), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected @@ -312,14 +312,14 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicMaxAgeParse() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicMaxAgeHandler(); h.parse(cookie, "2000"); assertNotNull(cookie.getExpiryDate()); } public void testBasicMaxAgeParseInvalid() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicMaxAgeHandler(); try { h.parse(cookie, "garbage"); @@ -346,7 +346,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicCommentParse() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicCommentHandler(); h.parse(cookie, "whatever"); assertEquals("whatever", cookie.getComment()); @@ -365,7 +365,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicSecureParse() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicSecureHandler(); h.parse(cookie, "whatever"); assertTrue(cookie.isSecure()); @@ -374,7 +374,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicSecureMatch() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicSecureHandler(); CookieOrigin origin1 = new CookieOrigin("somehost", 80, "/stuff", false); @@ -405,7 +405,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { // expected } try { - h.match(new BasicCookie("name", "value"), null); + h.match(new BasicClientCookie("name", "value"), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected @@ -413,7 +413,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicExpiresParse() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicExpiresHandler(new String[] {DateUtils.PATTERN_RFC1123}); DateFormat dateformat = new SimpleDateFormat(DateUtils.PATTERN_RFC1123, Locale.US); @@ -426,7 +426,7 @@ public class TestBasicCookieAttribHandlers extends TestCase { } public void testBasicExpiresParseInvalid() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new BasicExpiresHandler(new String[] {DateUtils.PATTERN_RFC1123}); try { h.parse(cookie, "garbage"); diff --git a/module-client/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java b/module-client/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java index 766784dde..7158b6b74 100644 --- a/module-client/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java +++ b/module-client/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java @@ -659,7 +659,7 @@ public class TestBrowserCompatSpec extends TestCase { * browser compatibility mode. */ public void testSecondDomainLevelCookie() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain(".sourceforge.net"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -671,7 +671,7 @@ public class TestBrowserCompatSpec extends TestCase { } public void testSecondDomainLevelCookieMatch1() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain(".sourceforge.net"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -683,7 +683,7 @@ public class TestBrowserCompatSpec extends TestCase { } public void testSecondDomainLevelCookieMatch2() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain("sourceforge.net"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -695,7 +695,7 @@ public class TestBrowserCompatSpec extends TestCase { } public void testSecondDomainLevelCookieMatch3() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain(".sourceforge.net"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -707,7 +707,7 @@ public class TestBrowserCompatSpec extends TestCase { } public void testInvalidSecondDomainLevelCookieMatch1() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain(".sourceforge.net"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -719,7 +719,7 @@ public class TestBrowserCompatSpec extends TestCase { } public void testInvalidSecondDomainLevelCookieMatch2() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain("sourceforge.net"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -732,7 +732,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testMatchBlankPath() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host"); cookie.setPath("/"); CookieOrigin origin = new CookieOrigin("host", 80, " ", false); @@ -741,7 +741,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testMatchNullCookieDomain() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setPath("/"); CookieOrigin origin = new CookieOrigin("host", 80, "/", false); assertFalse(cookiespec.match(cookie, origin)); @@ -749,7 +749,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testMatchNullCookiePath() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host"); CookieOrigin origin = new CookieOrigin("host", 80, "/", false); assertTrue(cookiespec.match(cookie, origin)); @@ -757,7 +757,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMatch1() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host"); cookie.setPath("/"); CookieOrigin origin = new CookieOrigin("host", 80, "/", false); @@ -766,7 +766,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMatch2() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain(".whatever.com"); cookie.setPath("/"); CookieOrigin origin = new CookieOrigin(".whatever.com", 80, "/", false); @@ -775,7 +775,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMatch3() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain(".whatever.com"); cookie.setPath("/"); CookieOrigin origin = new CookieOrigin(".really.whatever.com", 80, "/", false); @@ -784,7 +784,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMatch4() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host"); cookie.setPath("/"); CookieOrigin origin = new CookieOrigin("host", 80, "/foobar", false); @@ -793,7 +793,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMismatch1() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host1"); cookie.setPath("/"); CookieOrigin origin = new CookieOrigin("host2", 80, "/", false); @@ -802,7 +802,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMismatch2() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain(".aaaaaaaaa.com"); cookie.setPath("/"); CookieOrigin origin = new CookieOrigin(".bbbbbbbb.com", 80, "/", false); @@ -811,7 +811,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMismatch3() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host"); cookie.setPath("/foobar"); CookieOrigin origin = new CookieOrigin("host", 80, "/foo", false); @@ -820,7 +820,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMismatch4() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host"); cookie.setPath("/foobar"); CookieOrigin origin = new CookieOrigin("host", 80, "/foobar/", false); @@ -829,7 +829,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMatch5() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host"); cookie.setPath("/foobar/r"); CookieOrigin origin = new CookieOrigin("host", 80, "/foobar/", false); @@ -838,7 +838,7 @@ public class TestBrowserCompatSpec extends TestCase { public void testCookieMismatch6() throws Exception { CookieSpec cookiespec = new BrowserCompatSpec(); - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); cookie.setDomain("host"); cookie.setPath("/foobar"); cookie.setSecure(true); @@ -847,7 +847,7 @@ public class TestBrowserCompatSpec extends TestCase { } public void testInvalidMatchDomain() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain("beta.gamma.com"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -879,7 +879,7 @@ public class TestBrowserCompatSpec extends TestCase { * Tests if null cookie values are handled correctly. */ public void testNullCookieValueFormatting() { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain(".whatever.com"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -934,7 +934,7 @@ public class TestBrowserCompatSpec extends TestCase { // expected } try { - cookiespec.validate(new BasicCookie("name", null), null); + cookiespec.validate(new BasicClientCookie("name", null), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected @@ -946,7 +946,7 @@ public class TestBrowserCompatSpec extends TestCase { // expected } try { - cookiespec.match(new BasicCookie("name", null), null); + cookiespec.match(new BasicClientCookie("name", null), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected @@ -958,7 +958,7 @@ public class TestBrowserCompatSpec extends TestCase { // expected } try { - cookiespec.formatCookies(new BasicCookie[] {}); + cookiespec.formatCookies(new BasicClientCookie[] {}); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected diff --git a/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java b/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java index 8f1d704e7..370c9559d 100644 --- a/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java +++ b/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java @@ -210,14 +210,14 @@ public class TestCookieNetscapeDraft extends TestCase { } public void testFormatCookies() throws Exception { - BasicCookie c1 = new BasicCookie("name1", "value1"); + BasicClientCookie c1 = new BasicClientCookie("name1", "value1"); c1.setDomain(".whatever.com"); c1.setAttribute(ClientCookie.DOMAIN_ATTR, c1.getDomain()); c1.setPath("/"); c1.setAttribute(ClientCookie.PATH_ATTR, c1.getPath()); - Cookie c2 = new BasicCookie("name2", "value2"); - Cookie c3 = new BasicCookie("name3", null); + Cookie c2 = new BasicClientCookie("name2", "value2"); + Cookie c3 = new BasicClientCookie("name3", null); CookieSpec cookiespec = new NetscapeDraftSpec(); Header[] headers = cookiespec.formatCookies(new Cookie[] {c1, c2, c3}); @@ -247,7 +247,7 @@ public class TestCookieNetscapeDraft extends TestCase { // expected } try { - cookiespec.formatCookies(new BasicCookie[] {}); + cookiespec.formatCookies(new BasicClientCookie[] {}); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected diff --git a/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java b/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java index 6c32ddafe..4de8e78f2 100644 --- a/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java +++ b/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java @@ -170,7 +170,7 @@ public class TestCookieRFC2109Spec extends TestCase { * browser compatibility mode. */ public void testSecondDomainLevelCookie() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain(".sourceforge.net"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -187,7 +187,7 @@ public class TestCookieRFC2109Spec extends TestCase { } public void testSecondDomainLevelCookieMatch() throws Exception { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain(".sourceforge.net"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -362,7 +362,7 @@ public class TestCookieRFC2109Spec extends TestCase { * Tests if null cookie values are handled correctly. */ public void testNullCookieValueFormatting() { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setDomain(".whatever.com"); cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain()); cookie.setPath("/"); @@ -384,7 +384,7 @@ public class TestCookieRFC2109Spec extends TestCase { } public void testCookieNullDomainNullPathFormatting() { - BasicCookie cookie = new BasicCookie("name", null); + BasicClientCookie cookie = new BasicClientCookie("name", null); cookie.setPath("/"); cookie.setAttribute(ClientCookie.PATH_ATTR, cookie.getPath()); @@ -403,16 +403,16 @@ public class TestCookieRFC2109Spec extends TestCase { } public void testCookieOrderingByPath() { - BasicCookie c1 = new BasicCookie("name1", "value1"); + BasicClientCookie c1 = new BasicClientCookie("name1", "value1"); c1.setPath("/a/b/c"); c1.setAttribute(ClientCookie.PATH_ATTR, c1.getPath()); - BasicCookie c2 = new BasicCookie("name2", "value2"); + BasicClientCookie c2 = new BasicClientCookie("name2", "value2"); c2.setPath("/a/b"); c2.setAttribute(ClientCookie.PATH_ATTR, c2.getPath()); - BasicCookie c3 = new BasicCookie("name3", "value3"); + BasicClientCookie c3 = new BasicClientCookie("name3", "value3"); c3.setPath("/a"); c3.setAttribute(ClientCookie.PATH_ATTR, c3.getPath()); - BasicCookie c4 = new BasicCookie("name4", "value4"); + BasicClientCookie c4 = new BasicClientCookie("name4", "value4"); c4.setPath("/"); c4.setAttribute(ClientCookie.PATH_ATTR, c4.getPath()); @@ -453,7 +453,7 @@ public class TestCookieRFC2109Spec extends TestCase { // expected } try { - cookiespec.formatCookies(new BasicCookie[] {}); + cookiespec.formatCookies(new BasicClientCookie[] {}); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected diff --git a/module-client/src/test/java/org/apache/http/impl/cookie/TestNetscapeCookieAttribHandlers.java b/module-client/src/test/java/org/apache/http/impl/cookie/TestNetscapeCookieAttribHandlers.java index 3446933fa..231095a76 100644 --- a/module-client/src/test/java/org/apache/http/impl/cookie/TestNetscapeCookieAttribHandlers.java +++ b/module-client/src/test/java/org/apache/http/impl/cookie/TestNetscapeCookieAttribHandlers.java @@ -55,7 +55,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase { } public void testNetscapeDomainValidate1() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false); CookieAttributeHandler h = new NetscapeDomainHandler(); @@ -72,7 +72,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase { } public void testNetscapeDomainValidate2() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false); CookieAttributeHandler h = new NetscapeDomainHandler(); @@ -96,7 +96,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase { } public void testNetscapeDomainValidate3() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.a.com", 80, "/", false); CookieAttributeHandler h = new NetscapeDomainHandler(); @@ -113,7 +113,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase { } public void testNetscapeDomainValidate4() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.a.b.c", 80, "/", false); CookieAttributeHandler h = new NetscapeDomainHandler(); @@ -130,7 +130,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase { } public void testNetscapeDomainMatch1() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false); CookieAttributeHandler h = new NetscapeDomainHandler(); @@ -142,7 +142,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase { } public void testNetscapeDomainMatch2() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.whatever.somedomain.com", 80, "/", false); CookieAttributeHandler h = new NetscapeDomainHandler(); @@ -159,7 +159,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase { // expected } try { - h.match(new BasicCookie("name", "value"), null); + h.match(new BasicClientCookie("name", "value"), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected diff --git a/module-client/src/test/java/org/apache/http/impl/cookie/TestRFC2109CookieAttribHandlers.java b/module-client/src/test/java/org/apache/http/impl/cookie/TestRFC2109CookieAttribHandlers.java index 7bf91f519..a3a174cd1 100644 --- a/module-client/src/test/java/org/apache/http/impl/cookie/TestRFC2109CookieAttribHandlers.java +++ b/module-client/src/test/java/org/apache/http/impl/cookie/TestRFC2109CookieAttribHandlers.java @@ -55,7 +55,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainParse() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new RFC2109DomainHandler(); h.parse(cookie, "somehost"); @@ -76,7 +76,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainValidate1() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false); CookieAttributeHandler h = new RFC2109DomainHandler(); @@ -100,7 +100,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainValidate2() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false); CookieAttributeHandler h = new RFC2109DomainHandler(); @@ -124,7 +124,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainValidate3() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.a.com", 80, "/", false); CookieAttributeHandler h = new RFC2109DomainHandler(); @@ -141,7 +141,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainValidate4() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.a.b.c", 80, "/", false); CookieAttributeHandler h = new RFC2109DomainHandler(); @@ -165,7 +165,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainMatch1() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false); CookieAttributeHandler h = new RFC2109DomainHandler(); @@ -177,7 +177,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainMatch2() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.whatever.somedomain.com", 80, "/", false); CookieAttributeHandler h = new RFC2109DomainHandler(); @@ -186,7 +186,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainMatch3() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false); CookieAttributeHandler h = new RFC2109DomainHandler(); @@ -195,7 +195,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109DomainMatch4() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false); CookieAttributeHandler h = new RFC2109DomainHandler(); @@ -218,7 +218,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { // expected } try { - h.validate(new BasicCookie("name", "value"), null); + h.validate(new BasicClientCookie("name", "value"), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected @@ -230,7 +230,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { // expected } try { - h.match(new BasicCookie("name", "value"), null); + h.match(new BasicClientCookie("name", "value"), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException ex) { // expected @@ -238,14 +238,14 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109VersionParse() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new RFC2109VersionHandler(); h.parse(cookie, "12"); assertEquals(12, cookie.getVersion()); } public void testRFC2109VersionParseInvalid() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieAttributeHandler h = new RFC2109VersionHandler(); try { h.parse(cookie, "garbage"); @@ -268,7 +268,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase { } public void testRFC2109VersionValidate() throws Exception { - BasicCookie cookie = new BasicCookie("name", "value"); + BasicClientCookie cookie = new BasicClientCookie("name", "value"); CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false); CookieAttributeHandler h = new RFC2109VersionHandler();