Java 类org.apache.http.impl.cookie.DefaultCookieSpec 实例源码

项目:RobotServer    文件:HttpService.java   
@Override
public void afterPropertiesSet() throws Exception {
    cookieSpecRegistry = RegistryBuilder.<CookieSpecProvider> create().register("easy", new CookieSpecProvider() {
        public CookieSpec create(HttpContext context) {
            return new DefaultCookieSpec() {
                @Override
                public void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException {
                }
            };
        }
    }).build();

    requestConfig = RequestConfig.custom().setCookieSpec("easy")
            .setConnectionRequestTimeout(propertyConfigurer.getIntValue("connection.request.timeout"))
            .setSocketTimeout(propertyConfigurer.getIntValue("socket_timeout"))
            .setConnectTimeout(propertyConfigurer.getIntValue("connection_timeout")).build();
}
项目:jspider    文件:NoopCookieSpecProvider.java   
@Override
public CookieSpec create(HttpContext context) {
    String[] datePatterns = new String[] {
            DateUtils.PATTERN_RFC1123,
            DATE_PATTERN_NETSCAPE1,//default Netscape date pattern
    };
    return new DefaultCookieSpec(datePatterns, false) {
        @Override
        public void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException {
            //do nothing
        }
    };
}
项目:FCat    文件:HttpCallSSL.java   
/**
 * 获取当前Http客户端状态中的Cookie
 * 
 * @param domain
 *            作用域
 * @param port
 *            端口 传null 默认80
 * @param path
 *            Cookie路径 传null 默认"/"
 * @param useSecure
 *            Cookie是否采用安全机制 传null 默认false
 * @return
 */
public Map<String, Cookie> getCookie(String domain, Integer port, String path, Boolean useSecure) {
    if (domain == null) {
        return null;
    }
    if (port == null) {
        port = 80;
    }
    if (path == null) {
        path = "/";
    }
    if (useSecure == null) {
        useSecure = false;
    }
    List<Cookie> cookies = cookieStore.getCookies();
    if (cookies == null || cookies.isEmpty()) {
        return null;
    }

    CookieOrigin origin = new CookieOrigin(domain, port, path, useSecure);
    DefaultCookieSpec cookieSpec = new DefaultCookieSpec();
    Map<String, Cookie> retVal = new HashMap<String, Cookie>();
    for (Cookie cookie : cookies) {
        if (cookieSpec.match(cookie, origin)) {
            retVal.put(cookie.getName(), cookie);
        }
    }
    return retVal;
}
项目:lambda-local    文件:RestResponseEntity.java   
public RestResponseEntity build() {
    if (resultString == null && result == null) {
        throw new IllegalArgumentException("Either resultString or result must be set");
    }

    if (!cookies.isEmpty()) {
        DefaultCookieSpec defaultCookieSpec = new DefaultCookieSpec();
        defaultCookieSpec.formatCookies(cookies)
                .forEach(header -> headers.put(header.getName(), header.getValue()));
    }
    return new RestResponseEntity(statusCode, result, resultString, headers);
}
项目:purecloud-iot    文件:TestResponseProcessCookies.java   
@Before
public void setUp() throws Exception {
    this.cookieOrigin = new CookieOrigin("localhost", 80, "/", false);
    this.cookieSpec = new DefaultCookieSpec();
    this.cookieStore = new BasicCookieStore();
}