本文整理了Java中com.github.kevinsawicki.http.HttpRequest.acceptGzipEncoding()
方法的一些代码示例,展示了HttpRequest.acceptGzipEncoding()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.acceptGzipEncoding()
方法的具体详情如下:
包路径:com.github.kevinsawicki.http.HttpRequest
类名称:HttpRequest
方法名:acceptGzipEncoding
[英]Set the 'Accept-Encoding' header to 'gzip'
[中]将“接受编码”头设置为“gzip”
代码示例来源:origin: com.codeslap/github-jobs-java-api
String response = HttpRequest.get(url).acceptGzipEncoding().acceptJson().body();
if (response == null) {
throw new RuntimeException("Error calling API; it returned null.");
代码示例来源:origin: BoD/jraf-android-util
public static void setDefaultOptions(HttpRequest req) throws IOException {
req.userAgent(HTTP_USER_AGENT);
req.connectTimeout(CONNECT_TIMEOUT);
req.readTimeout(READ_TIMEOUT);
req.acceptGzipEncoding();
req.uncompress(true);
req.trustAllCerts();
req.trustAllHosts();
}
代码示例来源: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: 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();
}
内容来源于网络,如有侵权,请联系作者删除!