Renamed BasicCookie to BasicClientCookie; added BasicClientCookie2
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@578405 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d8d769db59
commit
1ccb1cfc27
|
@ -57,7 +57,7 @@ import org.apache.http.util.CharArrayBuffer;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @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.
|
* 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 name The name.
|
||||||
* @param value The value.
|
* @param value The value.
|
||||||
*/
|
*/
|
||||||
public BasicCookie(final String name, final String value) {
|
public BasicClientCookie(final String name, final String value) {
|
||||||
super();
|
super();
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
throw new IllegalArgumentException("Name may not be null");
|
throw new IllegalArgumentException("Name may not be null");
|
|
@ -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
|
||||||
|
* <http://www.apache.org/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public abstract class CookieSpecBase extends AbstractCookieSpec {
|
||||||
throw new MalformedCookieException("Cookie name may not be empty");
|
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.setPath(getDefaultPath(origin));
|
||||||
cookie.setDomain(getDefaultDomain(origin));
|
cookie.setDomain(getDefaultDomain(origin));
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ package org.apache.http.cookie;
|
||||||
|
|
||||||
import java.util.Comparator;
|
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.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
@ -57,9 +57,9 @@ public class TestCookiePathComparator extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUnequality1() {
|
public void testUnequality1() {
|
||||||
BasicCookie cookie1 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
|
||||||
cookie1.setPath("/a/b/");
|
cookie1.setPath("/a/b/");
|
||||||
BasicCookie cookie2 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
|
||||||
cookie2.setPath("/a/");
|
cookie2.setPath("/a/");
|
||||||
Comparator comparator = new CookiePathComparator();
|
Comparator comparator = new CookiePathComparator();
|
||||||
assertTrue(comparator.compare(cookie1, cookie2) < 0);
|
assertTrue(comparator.compare(cookie1, cookie2) < 0);
|
||||||
|
@ -67,9 +67,9 @@ public class TestCookiePathComparator extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUnequality2() {
|
public void testUnequality2() {
|
||||||
BasicCookie cookie1 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
|
||||||
cookie1.setPath("/a/b");
|
cookie1.setPath("/a/b");
|
||||||
BasicCookie cookie2 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
|
||||||
cookie2.setPath("/a");
|
cookie2.setPath("/a");
|
||||||
Comparator comparator = new CookiePathComparator();
|
Comparator comparator = new CookiePathComparator();
|
||||||
assertTrue(comparator.compare(cookie1, cookie2) < 0);
|
assertTrue(comparator.compare(cookie1, cookie2) < 0);
|
||||||
|
@ -77,9 +77,9 @@ public class TestCookiePathComparator extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEquality1() {
|
public void testEquality1() {
|
||||||
BasicCookie cookie1 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
|
||||||
cookie1.setPath("/a");
|
cookie1.setPath("/a");
|
||||||
BasicCookie cookie2 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
|
||||||
cookie2.setPath("/a");
|
cookie2.setPath("/a");
|
||||||
Comparator comparator = new CookiePathComparator();
|
Comparator comparator = new CookiePathComparator();
|
||||||
assertTrue(comparator.compare(cookie1, cookie2) == 0);
|
assertTrue(comparator.compare(cookie1, cookie2) == 0);
|
||||||
|
@ -87,9 +87,9 @@ public class TestCookiePathComparator extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEquality2() {
|
public void testEquality2() {
|
||||||
BasicCookie cookie1 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
|
||||||
cookie1.setPath("/a/");
|
cookie1.setPath("/a/");
|
||||||
BasicCookie cookie2 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
|
||||||
cookie2.setPath("/a");
|
cookie2.setPath("/a");
|
||||||
Comparator comparator = new CookiePathComparator();
|
Comparator comparator = new CookiePathComparator();
|
||||||
assertTrue(comparator.compare(cookie1, cookie2) == 0);
|
assertTrue(comparator.compare(cookie1, cookie2) == 0);
|
||||||
|
@ -97,9 +97,9 @@ public class TestCookiePathComparator extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEquality3() {
|
public void testEquality3() {
|
||||||
BasicCookie cookie1 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
|
||||||
cookie1.setPath(null);
|
cookie1.setPath(null);
|
||||||
BasicCookie cookie2 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
|
||||||
cookie2.setPath("/");
|
cookie2.setPath("/");
|
||||||
Comparator comparator = new CookiePathComparator();
|
Comparator comparator = new CookiePathComparator();
|
||||||
assertTrue(comparator.compare(cookie1, cookie2) == 0);
|
assertTrue(comparator.compare(cookie1, cookie2) == 0);
|
||||||
|
@ -107,9 +107,9 @@ public class TestCookiePathComparator extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEquality4() {
|
public void testEquality4() {
|
||||||
BasicCookie cookie1 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
|
||||||
cookie1.setPath("/this");
|
cookie1.setPath("/this");
|
||||||
BasicCookie cookie2 = new BasicCookie("name1", "value");
|
BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
|
||||||
cookie2.setPath("/that");
|
cookie2.setPath("/that");
|
||||||
Comparator comparator = new CookiePathComparator();
|
Comparator comparator = new CookiePathComparator();
|
||||||
assertTrue(comparator.compare(cookie1, cookie2) == 0);
|
assertTrue(comparator.compare(cookie1, cookie2) == 0);
|
||||||
|
|
|
@ -60,14 +60,14 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicDomainParse() throws Exception {
|
public void testBasicDomainParse() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new BasicDomainHandler();
|
CookieAttributeHandler h = new BasicDomainHandler();
|
||||||
h.parse(cookie, "www.somedomain.com");
|
h.parse(cookie, "www.somedomain.com");
|
||||||
assertEquals("www.somedomain.com", cookie.getDomain());
|
assertEquals("www.somedomain.com", cookie.getDomain());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicDomainParseInvalid() throws Exception {
|
public void testBasicDomainParseInvalid() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new BasicDomainHandler();
|
CookieAttributeHandler h = new BasicDomainHandler();
|
||||||
try {
|
try {
|
||||||
h.parse(cookie, "");
|
h.parse(cookie, "");
|
||||||
|
@ -84,7 +84,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicDomainValidate1() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new BasicDomainHandler();
|
CookieAttributeHandler h = new BasicDomainHandler();
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicDomainValidate2() throws Exception {
|
public void testBasicDomainValidate2() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
|
||||||
CookieAttributeHandler h = new BasicDomainHandler();
|
CookieAttributeHandler h = new BasicDomainHandler();
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicDomainValidate3() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new BasicDomainHandler();
|
CookieAttributeHandler h = new BasicDomainHandler();
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicDomainValidate4() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new BasicDomainHandler();
|
CookieAttributeHandler h = new BasicDomainHandler();
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicDomainMatch1() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new BasicDomainHandler();
|
CookieAttributeHandler h = new BasicDomainHandler();
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicDomainMatch2() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new BasicDomainHandler();
|
CookieAttributeHandler h = new BasicDomainHandler();
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
h.validate(new BasicCookie("name", "value"), null);
|
h.validate(new BasicClientCookie("name", "value"), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -201,7 +201,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
h.match(new BasicCookie("name", "value"), null);
|
h.match(new BasicClientCookie("name", "value"), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -209,7 +209,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathParse() throws Exception {
|
public void testBasicPathParse() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
h.parse(cookie, "stuff");
|
h.parse(cookie, "stuff");
|
||||||
assertEquals("stuff", cookie.getPath());
|
assertEquals("stuff", cookie.getPath());
|
||||||
|
@ -220,7 +220,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathMatch1() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
cookie.setPath("/stuff");
|
cookie.setPath("/stuff");
|
||||||
|
@ -228,7 +228,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathMatch2() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/", false);
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
cookie.setPath("/stuff");
|
cookie.setPath("/stuff");
|
||||||
|
@ -236,7 +236,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathMatch3() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/more-stuff", false);
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
cookie.setPath("/stuff");
|
cookie.setPath("/stuff");
|
||||||
|
@ -244,7 +244,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathMatch4() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuffed", false);
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
cookie.setPath("/stuff");
|
cookie.setPath("/stuff");
|
||||||
|
@ -252,7 +252,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathMatch5() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/otherstuff", false);
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
cookie.setPath("/stuff");
|
cookie.setPath("/stuff");
|
||||||
|
@ -260,7 +260,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathMatch6() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
cookie.setPath("/stuff/");
|
cookie.setPath("/stuff/");
|
||||||
|
@ -268,14 +268,14 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathMatch7() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
assertTrue(h.match(cookie, origin));
|
assertTrue(h.match(cookie, origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicPathValidate() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
|
||||||
CookieAttributeHandler h = new BasicPathHandler();
|
CookieAttributeHandler h = new BasicPathHandler();
|
||||||
cookie.setPath("/stuff");
|
cookie.setPath("/stuff");
|
||||||
|
@ -304,7 +304,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
h.match(new BasicCookie("name", "value"), null);
|
h.match(new BasicClientCookie("name", "value"), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -312,14 +312,14 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicMaxAgeParse() throws Exception {
|
public void testBasicMaxAgeParse() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new BasicMaxAgeHandler();
|
CookieAttributeHandler h = new BasicMaxAgeHandler();
|
||||||
h.parse(cookie, "2000");
|
h.parse(cookie, "2000");
|
||||||
assertNotNull(cookie.getExpiryDate());
|
assertNotNull(cookie.getExpiryDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicMaxAgeParseInvalid() throws Exception {
|
public void testBasicMaxAgeParseInvalid() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new BasicMaxAgeHandler();
|
CookieAttributeHandler h = new BasicMaxAgeHandler();
|
||||||
try {
|
try {
|
||||||
h.parse(cookie, "garbage");
|
h.parse(cookie, "garbage");
|
||||||
|
@ -346,7 +346,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicCommentParse() throws Exception {
|
public void testBasicCommentParse() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new BasicCommentHandler();
|
CookieAttributeHandler h = new BasicCommentHandler();
|
||||||
h.parse(cookie, "whatever");
|
h.parse(cookie, "whatever");
|
||||||
assertEquals("whatever", cookie.getComment());
|
assertEquals("whatever", cookie.getComment());
|
||||||
|
@ -365,7 +365,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicSecureParse() throws Exception {
|
public void testBasicSecureParse() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new BasicSecureHandler();
|
CookieAttributeHandler h = new BasicSecureHandler();
|
||||||
h.parse(cookie, "whatever");
|
h.parse(cookie, "whatever");
|
||||||
assertTrue(cookie.isSecure());
|
assertTrue(cookie.isSecure());
|
||||||
|
@ -374,7 +374,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicSecureMatch() throws Exception {
|
public void testBasicSecureMatch() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new BasicSecureHandler();
|
CookieAttributeHandler h = new BasicSecureHandler();
|
||||||
|
|
||||||
CookieOrigin origin1 = new CookieOrigin("somehost", 80, "/stuff", false);
|
CookieOrigin origin1 = new CookieOrigin("somehost", 80, "/stuff", false);
|
||||||
|
@ -405,7 +405,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
h.match(new BasicCookie("name", "value"), null);
|
h.match(new BasicClientCookie("name", "value"), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -413,7 +413,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicExpiresParse() throws Exception {
|
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});
|
CookieAttributeHandler h = new BasicExpiresHandler(new String[] {DateUtils.PATTERN_RFC1123});
|
||||||
|
|
||||||
DateFormat dateformat = new SimpleDateFormat(DateUtils.PATTERN_RFC1123, Locale.US);
|
DateFormat dateformat = new SimpleDateFormat(DateUtils.PATTERN_RFC1123, Locale.US);
|
||||||
|
@ -426,7 +426,7 @@ public class TestBasicCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasicExpiresParseInvalid() throws Exception {
|
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});
|
CookieAttributeHandler h = new BasicExpiresHandler(new String[] {DateUtils.PATTERN_RFC1123});
|
||||||
try {
|
try {
|
||||||
h.parse(cookie, "garbage");
|
h.parse(cookie, "garbage");
|
||||||
|
|
|
@ -659,7 +659,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
* browser compatibility mode.
|
* browser compatibility mode.
|
||||||
*/
|
*/
|
||||||
public void testSecondDomainLevelCookie() throws Exception {
|
public void testSecondDomainLevelCookie() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain(".sourceforge.net");
|
cookie.setDomain(".sourceforge.net");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -671,7 +671,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSecondDomainLevelCookieMatch1() throws Exception {
|
public void testSecondDomainLevelCookieMatch1() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain(".sourceforge.net");
|
cookie.setDomain(".sourceforge.net");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -683,7 +683,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSecondDomainLevelCookieMatch2() throws Exception {
|
public void testSecondDomainLevelCookieMatch2() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain("sourceforge.net");
|
cookie.setDomain("sourceforge.net");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -695,7 +695,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSecondDomainLevelCookieMatch3() throws Exception {
|
public void testSecondDomainLevelCookieMatch3() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain(".sourceforge.net");
|
cookie.setDomain(".sourceforge.net");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -707,7 +707,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInvalidSecondDomainLevelCookieMatch1() throws Exception {
|
public void testInvalidSecondDomainLevelCookieMatch1() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain(".sourceforge.net");
|
cookie.setDomain(".sourceforge.net");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -719,7 +719,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInvalidSecondDomainLevelCookieMatch2() throws Exception {
|
public void testInvalidSecondDomainLevelCookieMatch2() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain("sourceforge.net");
|
cookie.setDomain("sourceforge.net");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -732,7 +732,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testMatchBlankPath() throws Exception {
|
public void testMatchBlankPath() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host");
|
cookie.setDomain("host");
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
CookieOrigin origin = new CookieOrigin("host", 80, " ", false);
|
CookieOrigin origin = new CookieOrigin("host", 80, " ", false);
|
||||||
|
@ -741,7 +741,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testMatchNullCookieDomain() throws Exception {
|
public void testMatchNullCookieDomain() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
|
||||||
assertFalse(cookiespec.match(cookie, origin));
|
assertFalse(cookiespec.match(cookie, origin));
|
||||||
|
@ -749,7 +749,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testMatchNullCookiePath() throws Exception {
|
public void testMatchNullCookiePath() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host");
|
cookie.setDomain("host");
|
||||||
CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
|
||||||
assertTrue(cookiespec.match(cookie, origin));
|
assertTrue(cookiespec.match(cookie, origin));
|
||||||
|
@ -757,7 +757,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMatch1() throws Exception {
|
public void testCookieMatch1() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host");
|
cookie.setDomain("host");
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
|
||||||
|
@ -766,7 +766,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMatch2() throws Exception {
|
public void testCookieMatch2() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain(".whatever.com");
|
cookie.setDomain(".whatever.com");
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
CookieOrigin origin = new CookieOrigin(".whatever.com", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin(".whatever.com", 80, "/", false);
|
||||||
|
@ -775,7 +775,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMatch3() throws Exception {
|
public void testCookieMatch3() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain(".whatever.com");
|
cookie.setDomain(".whatever.com");
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
CookieOrigin origin = new CookieOrigin(".really.whatever.com", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin(".really.whatever.com", 80, "/", false);
|
||||||
|
@ -784,7 +784,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMatch4() throws Exception {
|
public void testCookieMatch4() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host");
|
cookie.setDomain("host");
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
CookieOrigin origin = new CookieOrigin("host", 80, "/foobar", false);
|
CookieOrigin origin = new CookieOrigin("host", 80, "/foobar", false);
|
||||||
|
@ -793,7 +793,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMismatch1() throws Exception {
|
public void testCookieMismatch1() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host1");
|
cookie.setDomain("host1");
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
CookieOrigin origin = new CookieOrigin("host2", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin("host2", 80, "/", false);
|
||||||
|
@ -802,7 +802,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMismatch2() throws Exception {
|
public void testCookieMismatch2() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain(".aaaaaaaaa.com");
|
cookie.setDomain(".aaaaaaaaa.com");
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
CookieOrigin origin = new CookieOrigin(".bbbbbbbb.com", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin(".bbbbbbbb.com", 80, "/", false);
|
||||||
|
@ -811,7 +811,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMismatch3() throws Exception {
|
public void testCookieMismatch3() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host");
|
cookie.setDomain("host");
|
||||||
cookie.setPath("/foobar");
|
cookie.setPath("/foobar");
|
||||||
CookieOrigin origin = new CookieOrigin("host", 80, "/foo", false);
|
CookieOrigin origin = new CookieOrigin("host", 80, "/foo", false);
|
||||||
|
@ -820,7 +820,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMismatch4() throws Exception {
|
public void testCookieMismatch4() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host");
|
cookie.setDomain("host");
|
||||||
cookie.setPath("/foobar");
|
cookie.setPath("/foobar");
|
||||||
CookieOrigin origin = new CookieOrigin("host", 80, "/foobar/", false);
|
CookieOrigin origin = new CookieOrigin("host", 80, "/foobar/", false);
|
||||||
|
@ -829,7 +829,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMatch5() throws Exception {
|
public void testCookieMatch5() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host");
|
cookie.setDomain("host");
|
||||||
cookie.setPath("/foobar/r");
|
cookie.setPath("/foobar/r");
|
||||||
CookieOrigin origin = new CookieOrigin("host", 80, "/foobar/", false);
|
CookieOrigin origin = new CookieOrigin("host", 80, "/foobar/", false);
|
||||||
|
@ -838,7 +838,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
|
|
||||||
public void testCookieMismatch6() throws Exception {
|
public void testCookieMismatch6() throws Exception {
|
||||||
CookieSpec cookiespec = new BrowserCompatSpec();
|
CookieSpec cookiespec = new BrowserCompatSpec();
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
cookie.setDomain("host");
|
cookie.setDomain("host");
|
||||||
cookie.setPath("/foobar");
|
cookie.setPath("/foobar");
|
||||||
cookie.setSecure(true);
|
cookie.setSecure(true);
|
||||||
|
@ -847,7 +847,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInvalidMatchDomain() throws Exception {
|
public void testInvalidMatchDomain() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain("beta.gamma.com");
|
cookie.setDomain("beta.gamma.com");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -879,7 +879,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
* Tests if null cookie values are handled correctly.
|
* Tests if null cookie values are handled correctly.
|
||||||
*/
|
*/
|
||||||
public void testNullCookieValueFormatting() {
|
public void testNullCookieValueFormatting() {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain(".whatever.com");
|
cookie.setDomain(".whatever.com");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -934,7 +934,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cookiespec.validate(new BasicCookie("name", null), null);
|
cookiespec.validate(new BasicClientCookie("name", null), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -946,7 +946,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cookiespec.match(new BasicCookie("name", null), null);
|
cookiespec.match(new BasicClientCookie("name", null), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -958,7 +958,7 @@ public class TestBrowserCompatSpec extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cookiespec.formatCookies(new BasicCookie[] {});
|
cookiespec.formatCookies(new BasicClientCookie[] {});
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
|
|
@ -210,14 +210,14 @@ public class TestCookieNetscapeDraft extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFormatCookies() throws Exception {
|
public void testFormatCookies() throws Exception {
|
||||||
BasicCookie c1 = new BasicCookie("name1", "value1");
|
BasicClientCookie c1 = new BasicClientCookie("name1", "value1");
|
||||||
c1.setDomain(".whatever.com");
|
c1.setDomain(".whatever.com");
|
||||||
c1.setAttribute(ClientCookie.DOMAIN_ATTR, c1.getDomain());
|
c1.setAttribute(ClientCookie.DOMAIN_ATTR, c1.getDomain());
|
||||||
c1.setPath("/");
|
c1.setPath("/");
|
||||||
c1.setAttribute(ClientCookie.PATH_ATTR, c1.getPath());
|
c1.setAttribute(ClientCookie.PATH_ATTR, c1.getPath());
|
||||||
|
|
||||||
Cookie c2 = new BasicCookie("name2", "value2");
|
Cookie c2 = new BasicClientCookie("name2", "value2");
|
||||||
Cookie c3 = new BasicCookie("name3", null);
|
Cookie c3 = new BasicClientCookie("name3", null);
|
||||||
|
|
||||||
CookieSpec cookiespec = new NetscapeDraftSpec();
|
CookieSpec cookiespec = new NetscapeDraftSpec();
|
||||||
Header[] headers = cookiespec.formatCookies(new Cookie[] {c1, c2, c3});
|
Header[] headers = cookiespec.formatCookies(new Cookie[] {c1, c2, c3});
|
||||||
|
@ -247,7 +247,7 @@ public class TestCookieNetscapeDraft extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cookiespec.formatCookies(new BasicCookie[] {});
|
cookiespec.formatCookies(new BasicClientCookie[] {});
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class TestCookieRFC2109Spec extends TestCase {
|
||||||
* browser compatibility mode.
|
* browser compatibility mode.
|
||||||
*/
|
*/
|
||||||
public void testSecondDomainLevelCookie() throws Exception {
|
public void testSecondDomainLevelCookie() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain(".sourceforge.net");
|
cookie.setDomain(".sourceforge.net");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -187,7 +187,7 @@ public class TestCookieRFC2109Spec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSecondDomainLevelCookieMatch() throws Exception {
|
public void testSecondDomainLevelCookieMatch() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain(".sourceforge.net");
|
cookie.setDomain(".sourceforge.net");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -362,7 +362,7 @@ public class TestCookieRFC2109Spec extends TestCase {
|
||||||
* Tests if null cookie values are handled correctly.
|
* Tests if null cookie values are handled correctly.
|
||||||
*/
|
*/
|
||||||
public void testNullCookieValueFormatting() {
|
public void testNullCookieValueFormatting() {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setDomain(".whatever.com");
|
cookie.setDomain(".whatever.com");
|
||||||
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, cookie.getDomain());
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
|
@ -384,7 +384,7 @@ public class TestCookieRFC2109Spec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCookieNullDomainNullPathFormatting() {
|
public void testCookieNullDomainNullPathFormatting() {
|
||||||
BasicCookie cookie = new BasicCookie("name", null);
|
BasicClientCookie cookie = new BasicClientCookie("name", null);
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
cookie.setAttribute(ClientCookie.PATH_ATTR, cookie.getPath());
|
cookie.setAttribute(ClientCookie.PATH_ATTR, cookie.getPath());
|
||||||
|
|
||||||
|
@ -403,16 +403,16 @@ public class TestCookieRFC2109Spec extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCookieOrderingByPath() {
|
public void testCookieOrderingByPath() {
|
||||||
BasicCookie c1 = new BasicCookie("name1", "value1");
|
BasicClientCookie c1 = new BasicClientCookie("name1", "value1");
|
||||||
c1.setPath("/a/b/c");
|
c1.setPath("/a/b/c");
|
||||||
c1.setAttribute(ClientCookie.PATH_ATTR, c1.getPath());
|
c1.setAttribute(ClientCookie.PATH_ATTR, c1.getPath());
|
||||||
BasicCookie c2 = new BasicCookie("name2", "value2");
|
BasicClientCookie c2 = new BasicClientCookie("name2", "value2");
|
||||||
c2.setPath("/a/b");
|
c2.setPath("/a/b");
|
||||||
c2.setAttribute(ClientCookie.PATH_ATTR, c2.getPath());
|
c2.setAttribute(ClientCookie.PATH_ATTR, c2.getPath());
|
||||||
BasicCookie c3 = new BasicCookie("name3", "value3");
|
BasicClientCookie c3 = new BasicClientCookie("name3", "value3");
|
||||||
c3.setPath("/a");
|
c3.setPath("/a");
|
||||||
c3.setAttribute(ClientCookie.PATH_ATTR, c3.getPath());
|
c3.setAttribute(ClientCookie.PATH_ATTR, c3.getPath());
|
||||||
BasicCookie c4 = new BasicCookie("name4", "value4");
|
BasicClientCookie c4 = new BasicClientCookie("name4", "value4");
|
||||||
c4.setPath("/");
|
c4.setPath("/");
|
||||||
c4.setAttribute(ClientCookie.PATH_ATTR, c4.getPath());
|
c4.setAttribute(ClientCookie.PATH_ATTR, c4.getPath());
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ public class TestCookieRFC2109Spec extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cookiespec.formatCookies(new BasicCookie[] {});
|
cookiespec.formatCookies(new BasicClientCookie[] {});
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNetscapeDomainValidate1() throws Exception {
|
public void testNetscapeDomainValidate1() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
|
||||||
CookieAttributeHandler h = new NetscapeDomainHandler();
|
CookieAttributeHandler h = new NetscapeDomainHandler();
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNetscapeDomainValidate2() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new NetscapeDomainHandler();
|
CookieAttributeHandler h = new NetscapeDomainHandler();
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNetscapeDomainValidate3() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.a.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new NetscapeDomainHandler();
|
CookieAttributeHandler h = new NetscapeDomainHandler();
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNetscapeDomainValidate4() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.a.b.c", 80, "/", false);
|
||||||
CookieAttributeHandler h = new NetscapeDomainHandler();
|
CookieAttributeHandler h = new NetscapeDomainHandler();
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNetscapeDomainMatch1() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new NetscapeDomainHandler();
|
CookieAttributeHandler h = new NetscapeDomainHandler();
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNetscapeDomainMatch2() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.whatever.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new NetscapeDomainHandler();
|
CookieAttributeHandler h = new NetscapeDomainHandler();
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public class TestNetscapeCookieAttribHandlers extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
h.match(new BasicCookie("name", "value"), null);
|
h.match(new BasicClientCookie("name", "value"), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainParse() throws Exception {
|
public void testRFC2109DomainParse() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
h.parse(cookie, "somehost");
|
h.parse(cookie, "somehost");
|
||||||
|
@ -76,7 +76,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainValidate1() throws Exception {
|
public void testRFC2109DomainValidate1() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
|
CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainValidate2() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainValidate3() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.a.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainValidate4() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.a.b.c", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainMatch1() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainMatch2() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.whatever.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainMatch3() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109DomainMatch4() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109DomainHandler();
|
CookieAttributeHandler h = new RFC2109DomainHandler();
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
h.validate(new BasicCookie("name", "value"), null);
|
h.validate(new BasicClientCookie("name", "value"), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -230,7 +230,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
h.match(new BasicCookie("name", "value"), null);
|
h.match(new BasicClientCookie("name", "value"), null);
|
||||||
fail("IllegalArgumentException must have been thrown");
|
fail("IllegalArgumentException must have been thrown");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// expected
|
// expected
|
||||||
|
@ -238,14 +238,14 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109VersionParse() throws Exception {
|
public void testRFC2109VersionParse() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new RFC2109VersionHandler();
|
CookieAttributeHandler h = new RFC2109VersionHandler();
|
||||||
h.parse(cookie, "12");
|
h.parse(cookie, "12");
|
||||||
assertEquals(12, cookie.getVersion());
|
assertEquals(12, cookie.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109VersionParseInvalid() throws Exception {
|
public void testRFC2109VersionParseInvalid() throws Exception {
|
||||||
BasicCookie cookie = new BasicCookie("name", "value");
|
BasicClientCookie cookie = new BasicClientCookie("name", "value");
|
||||||
CookieAttributeHandler h = new RFC2109VersionHandler();
|
CookieAttributeHandler h = new RFC2109VersionHandler();
|
||||||
try {
|
try {
|
||||||
h.parse(cookie, "garbage");
|
h.parse(cookie, "garbage");
|
||||||
|
@ -268,7 +268,7 @@ public class TestRFC2109CookieAttribHandlers extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRFC2109VersionValidate() throws Exception {
|
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);
|
CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
|
||||||
CookieAttributeHandler h = new RFC2109VersionHandler();
|
CookieAttributeHandler h = new RFC2109VersionHandler();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue