本文整理了Java中org.apache.http.HttpResponse.headerIterator()
方法的一些代码示例,展示了HttpResponse.headerIterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.headerIterator()
方法的具体详情如下:
包路径:org.apache.http.HttpResponse
类名称:HttpResponse
方法名:headerIterator
暂无
代码示例来源:origin: rest-assured/rest-assured
/**
* Used to allow Groovy iteration methods over the response headers.
* For example:
* <pre>response.headers.each {
* println "${it.name} : ${it.value}"
* }</pre>
*/
@SuppressWarnings("unchecked")
public Iterator<Object> iterator() {
return responseBase.headerIterator();
}
}
代码示例来源:origin: rest-assured/rest-assured
public HeaderIterator headerIterator( String arg0 ) {
return responseBase.headerIterator( arg0 );
}
代码示例来源:origin: rest-assured/rest-assured
public HeaderIterator headerIterator() {
return responseBase.headerIterator();
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
HeaderElementIterator it = new BasicHeaderElementIterator(response.headerIterator(HTTP.CONN_KEEP_ALIVE));
while (it.hasNext()) {
HeaderElement he = it.nextElement();
String param = he.getName();
String value = he.getValue();
if (value != null && param.equalsIgnoreCase(Constants.TIMEOUT_KEY)) {
return Long.parseLong(value) * 1000;
}
}
return HTTPCLIENT_KEEPALIVEDURATION;
}
})
代码示例来源:origin: apache/incubator-dubbo
@Override
public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
HeaderElementIterator it = new BasicHeaderElementIterator(response.headerIterator(HTTP.CONN_KEEP_ALIVE));
while (it.hasNext()) {
HeaderElement he = it.nextElement();
String param = he.getName();
String value = he.getValue();
if (value != null && param.equalsIgnoreCase(Constants.TIMEOUT_KEY)) {
return Long.parseLong(value) * 1000;
}
}
return HTTPCLIENT_KEEPALIVEDURATION;
}
})
代码示例来源:origin: robovm/robovm
return;
HeaderIterator it = response.headerIterator(SM.SET_COOKIE);
processCookies(it, cookieSpec, cookieOrigin, cookieStore);
it = response.headerIterator(SM.SET_COOKIE2);
processCookies(it, cookieSpec, cookieOrigin, cookieStore);
代码示例来源:origin: robovm/robovm
public Set<String> getAllowedMethods(final HttpResponse response) {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
}
HeaderIterator it = response.headerIterator("Allow");
Set<String> methods = new HashSet<String>();
while (it.hasNext()) {
Header header = it.nextHeader();
HeaderElement[] elements = header.getElements();
for (HeaderElement element : elements) {
methods.add(element.getName());
}
}
return methods;
}
代码示例来源:origin: knightliao/disconf
@Override
public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
HeaderElementIterator it = new BasicHeaderElementIterator(
response.headerIterator(HTTP.CONN_KEEP_ALIVE));
while (it.hasNext()) {
HeaderElement he = it.nextElement();
String param = he.getName();
String value = he.getValue();
if (value != null && param.equalsIgnoreCase("timeout")) {
try {
return Long.parseLong(value) * 1000;
} catch (NumberFormatException ignore) {
}
}
}
return keepAliveTimeOut * 1000;
}
代码示例来源:origin: robovm/robovm
public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
}
HeaderElementIterator it = new BasicHeaderElementIterator(
response.headerIterator(HTTP.CONN_KEEP_ALIVE));
while (it.hasNext()) {
HeaderElement he = it.nextElement();
String param = he.getName();
String value = he.getValue();
if (value != null && param.equalsIgnoreCase("timeout")) {
try {
return Long.parseLong(value) * 1000;
} catch(NumberFormatException ignore) {
}
}
}
return -1;
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldSupportHeaderIterator() throws Exception {
HttpResponse resp =
new TestHttpResponse(304, "REDIRECTED",
new BasicHeader("Location", "http://bar.com"),
new BasicHeader("Location", "http://zombo.com"));
HeaderIterator it = resp.headerIterator();
assertThat(it.hasNext()).isTrue();
assertThat(it.nextHeader().getValue()).isEqualTo("http://bar.com");
assertThat(it.nextHeader().getValue()).isEqualTo("http://zombo.com");
assertThat(it.hasNext()).isFalse();
}
代码示例来源:origin: robovm/robovm
HeaderIterator hit = response.headerIterator(HTTP.CONN_DIRECTIVE);
if (!hit.hasNext())
hit = response.headerIterator("Proxy-Connection");
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldSupportHeaderIteratorWithArg() throws Exception {
HttpResponse resp =
new TestHttpResponse(304, "REDIRECTED",
new BasicHeader("Location", "http://bar.com"),
new BasicHeader("X-Zombo-Com", "http://zombo.com"),
new BasicHeader("Location", "http://foo.com"));
HeaderIterator it = resp.headerIterator("Location");
assertThat(it.hasNext()).isTrue();
assertThat(it.nextHeader().getValue()).isEqualTo("http://bar.com");
assertThat(it.hasNext()).isTrue();
assertThat(it.nextHeader().getValue()).isEqualTo("http://foo.com");
assertThat(it.hasNext()).isFalse();
}
代码示例来源:origin: com.jayway.restassured/rest-assured
/**
* Used to allow Groovy iteration methods over the response headers.
* For example:
* <pre>response.headers.each {
* println "${it.name} : ${it.value}"
* }</pre>
*/
@SuppressWarnings("unchecked")
public Iterator<Object> iterator() {
return responseBase.headerIterator();
}
}
代码示例来源:origin: com.jayway.restassured/rest-assured
public HeaderIterator headerIterator() {
return responseBase.headerIterator();
}
代码示例来源:origin: com.jayway.restassured/rest-assured
public HeaderIterator headerIterator( String arg0 ) {
return responseBase.headerIterator( arg0 );
}
代码示例来源:origin: jgritman/httpbuilder
/**
* Used to allow Groovy iteration methods over the response headers.
* For example:
* <pre>response.headers.each {
* println "${it.name} : ${it.value}"
* }</pre>
*/
@SuppressWarnings("unchecked")
public Iterator iterator() {
return responseBase.headerIterator();
}
}
代码示例来源:origin: org.codehaus.groovy.modules.http-builder/http-builder
/**
* Used to allow Groovy iteration methods over the response headers.
* For example:
* <pre>response.headers.each {
* println "${it.name} : ${it.value}"
* }</pre>
*/
@SuppressWarnings("unchecked")
public Iterator iterator() {
return responseBase.headerIterator();
}
}
代码示例来源:origin: ibinti/bugvm
@Override
public HeaderIterator headerIterator(final String name) {
return original.headerIterator(name);
}
代码示例来源:origin: com.jkoolcloud/jesl
/**
* {@inheritDoc}
*/
@Override
public HeaderIterator headerIterator() {
return (response != null ? response.headerIterator() : super.headerIterator());
}
代码示例来源:origin: com.jkoolcloud/jesl
/**
* {@inheritDoc}
*/
@Override
public HeaderIterator headerIterator(String name) {
return (response != null ? response.headerIterator(name) : super.headerIterator(name));
}
内容来源于网络,如有侵权,请联系作者删除!