本文整理汇总了Java中org.apache.http.impl.cookie.DefaultCookieSpec类的典型用法代码示例。如果您正苦于以下问题:Java DefaultCookieSpec类的具体用法?Java DefaultCookieSpec怎么用?Java DefaultCookieSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultCookieSpec类属于org.apache.http.impl.cookie包,在下文中一共展示了DefaultCookieSpec类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import org.apache.http.impl.cookie.DefaultCookieSpec; //导入依赖的package包/类
@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();
}
开发者ID:JK-River,项目名称:RobotServer,代码行数:18,代码来源:HttpService.java
示例2: create
import org.apache.http.impl.cookie.DefaultCookieSpec; //导入依赖的package包/类
@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
}
};
}
开发者ID:brucezee,项目名称:jspider,代码行数:14,代码来源:NoopCookieSpecProvider.java
示例3: getCookie
import org.apache.http.impl.cookie.DefaultCookieSpec; //导入依赖的package包/类
/**
* 获取当前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;
}
开发者ID:fier-liu,项目名称:FCat,代码行数:42,代码来源:HttpCallSSL.java
示例4: build
import org.apache.http.impl.cookie.DefaultCookieSpec; //导入依赖的package包/类
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);
}
开发者ID:tempofeng,项目名称:lambda-local,代码行数:13,代码来源:RestResponseEntity.java
示例5: setUp
import org.apache.http.impl.cookie.DefaultCookieSpec; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.cookieOrigin = new CookieOrigin("localhost", 80, "/", false);
this.cookieSpec = new DefaultCookieSpec();
this.cookieStore = new BasicCookieStore();
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:7,代码来源:TestResponseProcessCookies.java
注:本文中的org.apache.http.impl.cookie.DefaultCookieSpec类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论