Java 类org.apache.http.cookie.CookieAttributeHandler 实例源码
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicDomainValidate2() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
final CookieAttributeHandler h = new BasicDomainHandler();
cookie.setDomain("somehost");
h.validate(cookie, origin);
cookie.setDomain("otherhost");
try {
h.validate(cookie, origin);
Assert.fail("MalformedCookieException should have been thrown");
} catch (final MalformedCookieException ex) {
// expected
}
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicDomainMatch2() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
final CookieAttributeHandler h = new BasicDomainHandler();
cookie.setDomain("somedomain.com");
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, "somedomain.com");
Assert.assertTrue(h.match(cookie, origin));
cookie.setDomain(".somedomain.com");
Assert.assertTrue(h.match(cookie, origin));
cookie.setDomain(null);
Assert.assertFalse(h.match(cookie, origin));
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicSecureMatch() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieAttributeHandler h = new BasicSecureHandler();
final CookieOrigin origin1 = new CookieOrigin("somehost", 80, "/stuff", false);
cookie.setSecure(false);
Assert.assertTrue(h.match(cookie, origin1));
cookie.setSecure(true);
Assert.assertFalse(h.match(cookie, origin1));
final CookieOrigin origin2 = new CookieOrigin("somehost", 80, "/stuff", true);
cookie.setSecure(false);
Assert.assertTrue(h.match(cookie, origin2));
cookie.setSecure(true);
Assert.assertTrue(h.match(cookie, origin2));
}
项目:purecloud-iot
文件:TestLaxCookieAttribHandlers.java
@Test
public void testParseExpiry() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieAttributeHandler h = new LaxExpiresHandler();
h.parse(cookie, "1:0:12 8-jan-2012");
final Date expiryDate = cookie.getExpiryDate();
Assert.assertNotNull(expiryDate);
final Calendar c = Calendar.getInstance();
c.setTimeZone(LaxExpiresHandler.UTC);
c.setTime(expiryDate);
Assert.assertEquals(2012, c.get(Calendar.YEAR));
Assert.assertEquals(Calendar.JANUARY, c.get(Calendar.MONTH));
Assert.assertEquals(8, c.get(Calendar.DAY_OF_MONTH));
Assert.assertEquals(1, c.get(Calendar.HOUR_OF_DAY));
Assert.assertEquals(0, c.get(Calendar.MINUTE));
Assert.assertEquals(12, c.get(Calendar.SECOND));
Assert.assertEquals(0, c.get(Calendar.MILLISECOND));
}
项目:purecloud-iot
文件:TestLaxCookieAttribHandlers.java
@Test
public void testParseExpiryFunnyTime() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieAttributeHandler h = new LaxExpiresHandler();
h.parse(cookie, "1:59:00blah; 8-feb-2000");
final Date expiryDate = cookie.getExpiryDate();
Assert.assertNotNull(expiryDate);
final Calendar c = Calendar.getInstance();
c.setTimeZone(LaxExpiresHandler.UTC);
c.setTime(expiryDate);
Assert.assertEquals(2000, c.get(Calendar.YEAR));
Assert.assertEquals(Calendar.FEBRUARY, c.get(Calendar.MONTH));
Assert.assertEquals(8, c.get(Calendar.DAY_OF_MONTH));
Assert.assertEquals(1, c.get(Calendar.HOUR_OF_DAY));
Assert.assertEquals(59, c.get(Calendar.MINUTE));
Assert.assertEquals(0, c.get(Calendar.SECOND));
Assert.assertEquals(0, c.get(Calendar.MILLISECOND));
}
项目:purecloud-iot
文件:TestLaxCookieAttribHandlers.java
@Test
public void testParseExpiryFunnyDayOfMonth() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieAttributeHandler h = new LaxExpiresHandler();
h.parse(cookie, "12:00:00 8blah;mar;1880");
final Date expiryDate = cookie.getExpiryDate();
Assert.assertNotNull(expiryDate);
final Calendar c = Calendar.getInstance();
c.setTimeZone(LaxExpiresHandler.UTC);
c.setTime(expiryDate);
Assert.assertEquals(1880, c.get(Calendar.YEAR));
Assert.assertEquals(Calendar.MARCH, c.get(Calendar.MONTH));
Assert.assertEquals(8, c.get(Calendar.DAY_OF_MONTH));
Assert.assertEquals(12, c.get(Calendar.HOUR_OF_DAY));
Assert.assertEquals(0, c.get(Calendar.MINUTE));
Assert.assertEquals(0, c.get(Calendar.SECOND));
Assert.assertEquals(0, c.get(Calendar.MILLISECOND));
}
项目:purecloud-iot
文件:TestLaxCookieAttribHandlers.java
@Test
public void testParseExpiryFunnyMonth() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieAttributeHandler h = new LaxExpiresHandler();
h.parse(cookie, "23:59:59; 1-ApriLLLLL-2008");
final Date expiryDate = cookie.getExpiryDate();
Assert.assertNotNull(expiryDate);
final Calendar c = Calendar.getInstance();
c.setTimeZone(LaxExpiresHandler.UTC);
c.setTime(expiryDate);
Assert.assertEquals(2008, c.get(Calendar.YEAR));
Assert.assertEquals(Calendar.APRIL, c.get(Calendar.MONTH));
Assert.assertEquals(1, c.get(Calendar.DAY_OF_MONTH));
Assert.assertEquals(23, c.get(Calendar.HOUR_OF_DAY));
Assert.assertEquals(59, c.get(Calendar.MINUTE));
Assert.assertEquals(59, c.get(Calendar.SECOND));
Assert.assertEquals(0, c.get(Calendar.MILLISECOND));
}
项目:purecloud-iot
文件:TestLaxCookieAttribHandlers.java
@Test
public void testParseExpiryFunnyYear() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieAttributeHandler h = new LaxExpiresHandler();
h.parse(cookie, "23:59:59; 1-Apr-2008blah");
final Date expiryDate = cookie.getExpiryDate();
Assert.assertNotNull(expiryDate);
final Calendar c = Calendar.getInstance();
c.setTimeZone(LaxExpiresHandler.UTC);
c.setTime(expiryDate);
Assert.assertEquals(2008, c.get(Calendar.YEAR));
Assert.assertEquals(Calendar.APRIL, c.get(Calendar.MONTH));
Assert.assertEquals(1, c.get(Calendar.DAY_OF_MONTH));
Assert.assertEquals(23, c.get(Calendar.HOUR_OF_DAY));
Assert.assertEquals(59, c.get(Calendar.MINUTE));
Assert.assertEquals(59, c.get(Calendar.SECOND));
Assert.assertEquals(0, c.get(Calendar.MILLISECOND));
}
项目:purecloud-iot
文件:TestRFC2109CookieAttribHandlers.java
@Test
public void testRFC2109DomainValidate3() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("www.a.com", 80, "/", false);
final CookieAttributeHandler h = new RFC2109DomainHandler();
cookie.setDomain(".a.com");
h.validate(cookie, origin);
cookie.setDomain(".com");
try {
h.validate(cookie, origin);
Assert.fail("MalformedCookieException should have been thrown");
} catch (final MalformedCookieException ex) {
// expected
}
}
项目:purecloud-iot
文件:TestRFC2109CookieAttribHandlers.java
@Test
public void testRFC2109VersionValidate() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
final CookieAttributeHandler h = new RFC2109VersionHandler();
cookie.setVersion(12);
h.validate(cookie, origin);
cookie.setVersion(-12);
try {
h.validate(cookie, origin);
Assert.fail("MalformedCookieException must have been thrown");
} catch (final MalformedCookieException ex) {
// expected
}
}
项目:purecloud-iot
文件:TestNetscapeCookieAttribHandlers.java
@Test
public void testNetscapeDomainValidate1() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
final CookieAttributeHandler h = new NetscapeDomainHandler();
cookie.setDomain("somehost");
h.validate(cookie, origin);
cookie.setDomain("otherhost");
try {
h.validate(cookie, origin);
Assert.fail("MalformedCookieException should have been thrown");
} catch (final MalformedCookieException ex) {
// expected
}
}
项目:purecloud-iot
文件:TestNetscapeCookieAttribHandlers.java
@Test
public void testNetscapeDomainValidate3() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("www.a.com", 80, "/", false);
final CookieAttributeHandler h = new NetscapeDomainHandler();
cookie.setDomain(".a.com");
h.validate(cookie, origin);
cookie.setDomain(".com");
try {
h.validate(cookie, origin);
Assert.fail("MalformedCookieException should have been thrown");
} catch (final MalformedCookieException ex) {
// expected
}
}
项目:purecloud-iot
文件:TestNetscapeCookieAttribHandlers.java
@Test
public void testNetscapeDomainValidate4() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("www.a.b.c", 80, "/", false);
final CookieAttributeHandler h = new NetscapeDomainHandler();
cookie.setDomain(".a.b.c");
h.validate(cookie, origin);
cookie.setDomain(".b.c");
try {
h.validate(cookie, origin);
Assert.fail("MalformedCookieException should have been thrown");
} catch (final MalformedCookieException ex) {
// expected
}
}
项目:lams
文件:CookieSpecBase.java
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin)
throws MalformedCookieException {
List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
for (HeaderElement headerelement : elems) {
String name = headerelement.getName();
String value = headerelement.getValue();
if (name == null || name.length() == 0) {
throw new MalformedCookieException("Cookie name may not be empty");
}
BasicClientCookie cookie = new BasicClientCookie(name, value);
cookie.setPath(getDefaultPath(origin));
cookie.setDomain(getDefaultDomain(origin));
// cycle through the parameters
NameValuePair[] attribs = headerelement.getParameters();
for (int j = attribs.length - 1; j >= 0; j--) {
NameValuePair attrib = attribs[j];
String s = attrib.getName().toLowerCase(Locale.ENGLISH);
cookie.setAttribute(s, attrib.getValue());
CookieAttributeHandler handler = findAttribHandler(s);
if (handler != null) {
handler.parse(cookie, attrib.getValue());
}
}
cookies.add(cookie);
}
return cookies;
}
项目:lams
文件:CookieSpecBase.java
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (origin == null) {
throw new IllegalArgumentException("Cookie origin may not be null");
}
for (CookieAttributeHandler handler: getAttribHandlers()) {
handler.validate(cookie, origin);
}
}
项目:lams
文件:CookieSpecBase.java
public boolean match(final Cookie cookie, final CookieOrigin origin) {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (origin == null) {
throw new IllegalArgumentException("Cookie origin may not be null");
}
for (CookieAttributeHandler handler: getAttribHandlers()) {
if (!handler.match(cookie, origin)) {
return false;
}
}
return true;
}
项目:lams
文件:AbstractCookieSpec.java
public void registerAttribHandler(
final String name, final CookieAttributeHandler handler) {
if (name == null) {
throw new IllegalArgumentException("Attribute name may not be null");
}
if (handler == null) {
throw new IllegalArgumentException("Attribute handler may not be null");
}
this.attribHandlerMap.put(name, handler);
}
项目:lams
文件:AbstractCookieSpec.java
/**
* Gets attribute handler {@link CookieAttributeHandler} for the
* given attribute.
*
* @param name attribute name. e.g. Domain, Path, etc.
* @throws IllegalStateException if handler not found for the
* specified attribute.
*/
protected CookieAttributeHandler getAttribHandler(final String name) {
CookieAttributeHandler handler = findAttribHandler(name);
if (handler == null) {
throw new IllegalStateException("Handler not registered for " +
name + " attribute.");
} else {
return handler;
}
}
项目:remote-files-sync
文件:AbstractCookieSpecHC4.java
/**
* Gets attribute handler {@link CookieAttributeHandler} for the
* given attribute.
*
* @param name attribute name. e.g. Domain, Path, etc.
* @throws IllegalStateException if handler not found for the
* specified attribute.
*/
protected CookieAttributeHandler getAttribHandler(final String name) {
final CookieAttributeHandler handler = findAttribHandler(name);
if (handler == null) {
throw new IllegalStateException("Handler not registered for " +
name + " attribute.");
} else {
return handler;
}
}
项目:remote-files-sync
文件:CookieSpecBaseHC4.java
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin)
throws MalformedCookieException {
final List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
for (final HeaderElement headerelement : elems) {
final String name = headerelement.getName();
final String value = headerelement.getValue();
if (name == null || name.length() == 0) {
throw new MalformedCookieException("Cookie name may not be empty");
}
final BasicClientCookieHC4 cookie = new BasicClientCookieHC4(name, value);
cookie.setPath(getDefaultPath(origin));
cookie.setDomain(getDefaultDomain(origin));
// cycle through the parameters
final NameValuePair[] attribs = headerelement.getParameters();
for (int j = attribs.length - 1; j >= 0; j--) {
final NameValuePair attrib = attribs[j];
final String s = attrib.getName().toLowerCase(Locale.ENGLISH);
cookie.setAttribute(s, attrib.getValue());
final CookieAttributeHandler handler = findAttribHandler(s);
if (handler != null) {
handler.parse(cookie, attrib.getValue());
}
}
cookies.add(cookie);
}
return cookies;
}
项目:remote-files-sync
文件:CookieSpecBaseHC4.java
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
Args.notNull(origin, "Cookie origin");
for (final CookieAttributeHandler handler: getAttribHandlers()) {
handler.validate(cookie, origin);
}
}
项目:remote-files-sync
文件:CookieSpecBaseHC4.java
public boolean match(final Cookie cookie, final CookieOrigin origin) {
Args.notNull(cookie, "Cookie");
Args.notNull(origin, "Cookie origin");
for (final CookieAttributeHandler handler: getAttribHandlers()) {
if (!handler.match(cookie, origin)) {
return false;
}
}
return true;
}
项目:purecloud-iot
文件:RFC6265CookieSpec.java
protected RFC6265CookieSpec(final CommonCookieAttributeHandler... handlers) {
super();
this.attribHandlers = handlers.clone();
this.attribHandlerMap = new ConcurrentHashMap<String, CookieAttributeHandler>(handlers.length);
for (final CommonCookieAttributeHandler handler: handlers) {
this.attribHandlerMap.put(handler.getAttributeName().toLowerCase(Locale.ROOT), handler);
}
this.tokenParser = TokenParser.INSTANCE;
}
项目:purecloud-iot
文件:RFC6265CookieSpec.java
@Override
public final void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
Args.notNull(origin, "Cookie origin");
for (final CookieAttributeHandler handler: this.attribHandlers) {
handler.validate(cookie, origin);
}
}
项目:purecloud-iot
文件:RFC6265CookieSpec.java
@Override
public final boolean match(final Cookie cookie, final CookieOrigin origin) {
Args.notNull(cookie, "Cookie");
Args.notNull(origin, "Cookie origin");
for (final CookieAttributeHandler handler: this.attribHandlers) {
if (!handler.match(cookie, origin)) {
return false;
}
}
return true;
}
项目:purecloud-iot
文件:CookieSpecBase.java
protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin)
throws MalformedCookieException {
final List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
for (final HeaderElement headerelement : elems) {
final String name = headerelement.getName();
final String value = headerelement.getValue();
if (name == null || name.isEmpty()) {
continue;
}
final BasicClientCookie cookie = new BasicClientCookie(name, value);
cookie.setPath(getDefaultPath(origin));
cookie.setDomain(getDefaultDomain(origin));
// cycle through the parameters
final NameValuePair[] attribs = headerelement.getParameters();
for (int j = attribs.length - 1; j >= 0; j--) {
final NameValuePair attrib = attribs[j];
final String s = attrib.getName().toLowerCase(Locale.ROOT);
cookie.setAttribute(s, attrib.getValue());
final CookieAttributeHandler handler = findAttribHandler(s);
if (handler != null) {
handler.parse(cookie, attrib.getValue());
}
}
cookies.add(cookie);
}
return cookies;
}
项目:purecloud-iot
文件:CookieSpecBase.java
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
Args.notNull(origin, "Cookie origin");
for (final CookieAttributeHandler handler: getAttribHandlers()) {
handler.validate(cookie, origin);
}
}
项目:purecloud-iot
文件:CookieSpecBase.java
@Override
public boolean match(final Cookie cookie, final CookieOrigin origin) {
Args.notNull(cookie, "Cookie");
Args.notNull(origin, "Cookie origin");
for (final CookieAttributeHandler handler: getAttribHandlers()) {
if (!handler.match(cookie, origin)) {
return false;
}
}
return true;
}
项目:purecloud-iot
文件:AbstractCookieSpec.java
/**
* @since 4.4
*/
protected AbstractCookieSpec(final CommonCookieAttributeHandler... handlers) {
super();
this.attribHandlerMap = new ConcurrentHashMap<String, CookieAttributeHandler>(handlers.length);
for (final CommonCookieAttributeHandler handler: handlers) {
this.attribHandlerMap.put(handler.getAttributeName(), handler);
}
}
项目:purecloud-iot
文件:AbstractCookieSpec.java
/**
* @deprecated (4.4) use {@link #AbstractCookieSpec(java.util.HashMap)} or
* {@link #AbstractCookieSpec(org.apache.http.cookie.CommonCookieAttributeHandler...)}
* constructors instead.
*/
@Deprecated
public void registerAttribHandler(
final String name, final CookieAttributeHandler handler) {
Args.notNull(name, "Attribute name");
Args.notNull(handler, "Attribute handler");
this.attribHandlerMap.put(name, handler);
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicDomainParse() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieAttributeHandler h = new BasicDomainHandler();
h.parse(cookie, "www.somedomain.com");
Assert.assertEquals("www.somedomain.com", cookie.getDomain());
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicDomainValidate3() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
final CookieAttributeHandler h = new BasicDomainHandler();
cookie.setDomain(".somedomain.com");
h.validate(cookie, origin);
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicDomainValidate4() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
final CookieAttributeHandler h = new BasicDomainHandler();
cookie.setDomain(null);
try {
h.validate(cookie, origin);
Assert.fail("MalformedCookieException should have been thrown");
} catch (final MalformedCookieException ex) {
// expected
}
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicDomainMatch1() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
final CookieAttributeHandler h = new BasicDomainHandler();
cookie.setDomain("somedomain.com");
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, "somedomain.com");
Assert.assertTrue(h.match(cookie, origin));
cookie.setDomain(".somedomain.com");
Assert.assertTrue(h.match(cookie, origin));
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicDomainMatchOneLetterPrefix() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("a.somedomain.com", 80, "/", false);
final CookieAttributeHandler h = new BasicDomainHandler();
cookie.setDomain("somedomain.com");
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, "somedomain.com");
Assert.assertTrue(h.match(cookie, origin));
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicDomainMatchMixedCase() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("a.SomeDomain.com", 80, "/", false);
final CookieAttributeHandler h = new BasicDomainHandler();
cookie.setDomain("somedoMain.Com");
cookie.setAttribute(ClientCookie.DOMAIN_ATTR, "somedoMain.Com");
Assert.assertTrue(h.match(cookie, origin));
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicPathParse() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieAttributeHandler h = new BasicPathHandler();
h.parse(cookie, "stuff");
Assert.assertEquals("stuff", cookie.getPath());
h.parse(cookie, "");
Assert.assertEquals("/", cookie.getPath());
h.parse(cookie, null);
Assert.assertEquals("/", cookie.getPath());
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicPathMatch1() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
final CookieAttributeHandler h = new BasicPathHandler();
cookie.setPath("/stuff");
Assert.assertTrue(h.match(cookie, origin));
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicPathMatch2() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/", false);
final CookieAttributeHandler h = new BasicPathHandler();
cookie.setPath("/stuff");
Assert.assertTrue(h.match(cookie, origin));
}
项目:purecloud-iot
文件:TestBasicCookieAttribHandlers.java
@Test
public void testBasicPathMatch3() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
final CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/more-stuff", false);
final CookieAttributeHandler h = new BasicPathHandler();
cookie.setPath("/stuff");
Assert.assertTrue(h.match(cookie, origin));
}