本文整理了Java中com.github.kevinsawicki.http.HttpRequest.headers()
方法的一些代码示例,展示了HttpRequest.headers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.headers()
方法的具体详情如下:
包路径:com.github.kevinsawicki.http.HttpRequest
类名称:HttpRequest
方法名:headers
[英]Get all the response headers
[中]获取所有响应头
代码示例来源:origin: com.github.kevinsawicki/http-request
/**
* Get all values of the given header from the response
*
* @param name
* @return non-null but possibly empty array of {@link String} header values
*/
public String[] headers(final String name) {
final Map<String, List<String>> headers = headers();
if (headers == null || headers.isEmpty())
return EMPTY_STRINGS;
final List<String> values = headers.get(name);
if (values != null && !values.isEmpty())
return values.toArray(new String[values.size()]);
else
return EMPTY_STRINGS;
}
代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse
/**
* Get all values of the given header from the response
*
* @param name
* @return non-null but possibly empty array of {@link String} header values
*/
public String[] headers(final String name) {
final Map<String, List<String>> headers = headers();
if (headers == null || headers.isEmpty())
return EMPTY_STRINGS;
final List<String> values = headers.get(name);
if (values != null && !values.isEmpty())
return values.toArray(new String[values.size()]);
else
return EMPTY_STRINGS;
}
代码示例来源:origin: tcking/GiraffePlayer2
/**
* Get all values of the given header from the response
*
* @param name
* @return non-null but possibly empty array of {@link String} header values
*/
public String[] headers(final String name) {
final Map<String, List<String>> headers = headers();
if (headers == null || headers.isEmpty())
return EMPTY_STRINGS;
final List<String> values = headers.get(name);
if (values != null && !values.isEmpty())
return values.toArray(new String[values.size()]);
else
return EMPTY_STRINGS;
}
代码示例来源:origin: lkorth/httpebble-android
/**
* Get all values of the given header from the response
*
* @param name
* @return non-null but possibly empty array of {@link String} header values
*/
public String[] headers(final String name) {
final Map<String, List<String>> headers = headers();
if (headers == null || headers.isEmpty())
return EMPTY_STRINGS;
final List<String> values = headers.get(name);
if (values != null && !values.isEmpty())
return values.toArray(new String[values.size()]);
else
return EMPTY_STRINGS;
}
代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse
public ResponseImpl( HttpRequest request ) {
body = request.body();
contentType = request.contentType();
headers = request.headers();
code = request.code();
url = request.getConnection().getURL().toString();
request.disconnect();
}
代码示例来源:origin: no.cantara.base/Hystrix-BaseCommands
protected HttpResponse getResponse(HttpRequest request) {
byte[] responseBody = request.bytes();
int statusCode = request.code();
String reasonPhrase = request.message();
Map<String, List<String>> headers = request.headers();
return new HttpResponse(statusCode, responseBody, reasonPhrase, headers);
}
代码示例来源:origin: ihaolin/antares
private String doPost() {
HttpRequest post = HttpRequest.post(url, params, encode)
.headers(headers)
.connectTimeout(connectTimeout)
.readTimeout(readTimeout)
.acceptGzipEncoding()
.uncompress(true);
setOptionalHeaders(post);
if (!Strings.isNullOrEmpty(body)){
post.send(body);
}
if (ssl){
trustHttps(post);
}
return post.body();
}
代码示例来源:origin: ihaolin/antares
private String doGet() {
HttpRequest get = HttpRequest.get(url, params, encode)
.headers(headers)
.connectTimeout(connectTimeout)
.readTimeout(readTimeout)
.acceptGzipEncoding()
.uncompress(true);
if (ssl){
trustHttps(get);
}
setOptionalHeaders(get);
return get.body();
}
代码示例来源:origin: me.hao0/common
private String doGet() {
HttpRequest get = HttpRequest.get(url, params, encode)
.headers(headers)
.connectTimeout(connectTimeout)
.readTimeout(readTimeout)
.acceptGzipEncoding()
.uncompress(true);
if (ssl){
trustHttps(get);
}
setOptionalHeaders(get);
return get.body();
}
代码示例来源:origin: ihaolin/common
private String doGet() {
HttpRequest get = HttpRequest.get(url, params, encode)
.headers(headers)
.connectTimeout(connectTimeout)
.readTimeout(readTimeout)
.acceptGzipEncoding()
.uncompress(true);
if (ssl){
trustHttps(get);
}
setOptionalHeaders(get);
return get.body();
}
代码示例来源:origin: no.cantara.base/Hystrix-BaseCommands
byte[] responseBodyCopy = responseBody.clone();
int statusCode = request.code();
log.debug("Headers {}", request.headers());
String responseAsText = StringConv.UTF8(responseBody);
代码示例来源:origin: me.hao0/common
private String doPost() {
HttpRequest post = HttpRequest.post(url, params, encode)
.headers(headers)
.connectTimeout(connectTimeout)
.readTimeout(readTimeout)
.acceptGzipEncoding()
.uncompress(true);
setOptionalHeaders(post);
if (!Strings.isNullOrEmpty(body)){
post.send(body);
}
if (ssl){
trustHttps(post);
}
return post.body();
}
代码示例来源:origin: ihaolin/common
private String doPost() {
HttpRequest post = HttpRequest.post(url, params, encode)
.headers(headers)
.connectTimeout(connectTimeout)
.readTimeout(readTimeout)
.acceptGzipEncoding()
.uncompress(true);
setOptionalHeaders(post);
if (!Strings.isNullOrEmpty(body)){
post.send(body);
}
if (ssl){
trustHttps(post);
}
return post.body();
}
内容来源于网络,如有侵权,请联系作者删除!