当前位置: 首页>>代码示例>>Java>>正文


Java CookieAttributeHandler.validate方法代码示例

本文整理汇总了Java中org.apache.http.cookie.CookieAttributeHandler.validate方法的典型用法代码示例。如果您正苦于以下问题:Java CookieAttributeHandler.validate方法的具体用法?Java CookieAttributeHandler.validate怎么用?Java CookieAttributeHandler.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.cookie.CookieAttributeHandler的用法示例。


在下文中一共展示了CookieAttributeHandler.validate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBasicDomainValidate2

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:18,代码来源:TestBasicCookieAttribHandlers.java

示例2: testRFC2109DomainValidate3

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:18,代码来源:TestRFC2109CookieAttribHandlers.java

示例3: testRFC2109VersionValidate

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:18,代码来源:TestRFC2109CookieAttribHandlers.java

示例4: testNetscapeDomainValidate1

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:18,代码来源:TestNetscapeCookieAttribHandlers.java

示例5: testNetscapeDomainValidate3

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:18,代码来源:TestNetscapeCookieAttribHandlers.java

示例6: testNetscapeDomainValidate4

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:18,代码来源:TestNetscapeCookieAttribHandlers.java

示例7: validate

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:CookieSpecBase.java

示例8: validate

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:9,代码来源:CookieSpecBaseHC4.java

示例9: validate

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:10,代码来源:RFC6265CookieSpec.java

示例10: validate

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:10,代码来源:CookieSpecBase.java

示例11: testBasicDomainValidate3

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:10,代码来源:TestBasicCookieAttribHandlers.java

示例12: testBasicDomainValidate4

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@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
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:15,代码来源:TestBasicCookieAttribHandlers.java

示例13: testBasicPathValidate

import org.apache.http.cookie.CookieAttributeHandler; //导入方法依赖的package包/类
@Test
public void testBasicPathValidate() 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");
    h.validate(cookie, origin);
    cookie.setPath("/stuffed");
    try {
        h.validate(cookie, origin);
        Assert.fail("MalformedCookieException must have been thrown");
    } catch (final MalformedCookieException ex) {
        // expected
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:16,代码来源:TestBasicCookieAttribHandlers.java


注:本文中的org.apache.http.cookie.CookieAttributeHandler.validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。