本文整理了Java中com.ning.http.client.RequestBuilder.addOrReplaceCookie
方法的一些代码示例,展示了RequestBuilder.addOrReplaceCookie
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RequestBuilder.addOrReplaceCookie
方法的具体详情如下:
包路径:com.ning.http.client.RequestBuilder
类名称:RequestBuilder
方法名:addOrReplaceCookie
暂无
代码示例来源:origin: com.ning/async-http-client
private static Request newRequest(final HttpTransactionContext ctx,
final Uri newUri, final HttpResponsePacket response,
final Realm realm, boolean asGet) {
final Request prototype = ctx.getAhcRequest();
final FluentCaseInsensitiveStringsMap prototypeHeaders =
prototype.getHeaders();
prototypeHeaders.remove(Header.Host.toString());
prototypeHeaders.remove(Header.ContentLength.toString());
if (asGet)
prototypeHeaders.remove(Header.ContentType.toString());
if (realm != null && realm.getScheme() == AuthScheme.NTLM) {
prototypeHeaders.remove(Header.Authorization.toString());
prototypeHeaders.remove(Header.ProxyAuthorization.toString());
}
final RequestBuilder builder = new RequestBuilder(prototype);
if (asGet) {
builder.setMethod("GET");
}
builder.setUrl(newUri.toString());
for (String cookieStr : response.getHeaders().values(Header.SetCookie)) {
builder.addOrReplaceCookie(CookieDecoder.decode(cookieStr));
}
return builder.build();
}
代码示例来源:origin: com.ning/async-http-client
Cookie c = CookieDecoder.decode(cookieStr);
if (c != null)
requestBuilder.addOrReplaceCookie(c);
代码示例来源:origin: io.gatling/async-http-client
private static Request newRequest(final UriComponents uri,
final HttpResponsePacket response,
final HttpTransactionContext ctx,
boolean asGet) {
final RequestBuilder builder = new RequestBuilder(ctx.request);
if (asGet) {
builder.setMethod("GET");
}
builder.setUrl(uri.toString());
if (ctx.provider.clientConfig.isRemoveQueryParamOnRedirect()) {
builder.resetQuery();
} else {
builder.addQueryParams(ctx.request.getQueryParams());
}
for (String cookieStr : response.getHeaders().values(Header.Cookie)) {
builder.addOrReplaceCookie(CookieDecoder.decode(cookieStr));
}
return builder.build();
}
代码示例来源:origin: io.gatling/async-http-client
Cookie c = CookieDecoder.decode(cookieStr, timeConverter);
if (c != null)
requestBuilder.addOrReplaceCookie(c);
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-client
private static Request newRequest(final HttpTransactionContext ctx,
final Uri newUri, final HttpResponsePacket response,
final Realm realm, boolean asGet) {
final Request prototype = ctx.getAhcRequest();
final FluentCaseInsensitiveStringsMap prototypeHeaders =
prototype.getHeaders();
prototypeHeaders.remove(Header.Host.toString());
prototypeHeaders.remove(Header.ContentLength.toString());
if (asGet)
prototypeHeaders.remove(Header.ContentType.toString());
if (realm != null && realm.getScheme() == AuthScheme.NTLM) {
prototypeHeaders.remove(Header.Authorization.toString());
prototypeHeaders.remove(Header.ProxyAuthorization.toString());
}
final RequestBuilder builder = new RequestBuilder(prototype);
if (asGet) {
builder.setMethod("GET");
}
builder.setUrl(newUri.toString());
for (String cookieStr : response.getHeaders().values(Header.SetCookie)) {
builder.addOrReplaceCookie(CookieDecoder.decode(cookieStr));
}
return builder.build();
}
代码示例来源:origin: javaee/grizzly-ahc
private static Request newRequest(final HttpTransactionContext ctx,
final Uri newUri, final HttpResponsePacket response,
final Realm realm, boolean asGet) {
final Request prototype = ctx.getAhcRequest();
final FluentCaseInsensitiveStringsMap prototypeHeaders =
prototype.getHeaders();
prototypeHeaders.remove(Header.Host.toString());
prototypeHeaders.remove(Header.ContentLength.toString());
if (asGet)
prototypeHeaders.remove(Header.ContentType.toString());
if (realm != null && realm.getScheme() == AuthScheme.NTLM) {
prototypeHeaders.remove(Header.Authorization.toString());
prototypeHeaders.remove(Header.ProxyAuthorization.toString());
}
final RequestBuilder builder = new RequestBuilder(prototype);
if (asGet) {
builder.setMethod("GET");
}
builder.setUrl(newUri.toString());
for (String cookieStr : response.getHeaders().values(Header.SetCookie)) {
builder.addOrReplaceCookie(CookieDecoder.decode(cookieStr));
}
return builder.build();
}
内容来源于网络,如有侵权,请联系作者删除!