本文整理汇总了Java中com.mashape.unirest.http.options.Options类的典型用法代码示例。如果您正苦于以下问题:Java Options类的具体用法?Java Options怎么用?Java Options使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Options类属于com.mashape.unirest.http.options包,在下文中一共展示了Options类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configure
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
/**
* configures the rest engine
*/
@Override
public void configure(final BreinConfig config) {
final long connectionTimeout = config.getConnectionTimeout();
final long socketTimeout = config.getSocketTimeout();
if (connectionTimeout != 0 && socketTimeout != 0) {
Options.refresh();
Unirest.setTimeouts(connectionTimeout, socketTimeout);
// we need to warm-up Unirest, see https://github.com/Mashape/unirest-java/issues/92
final Future<HttpResponse<String>> future = Unirest
.get("https://www.breinify.com").asStringAsync();
while (!future.isDone()) {
// wait for the request to return
}
}
}
开发者ID:Breinify,项目名称:brein-api-library-java,代码行数:22,代码来源:UniRestEngine.java
示例2: setupProxying
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
@BeforeClass
public static void setupProxying() {
DnsResolver dnsResolver = prepareProxiedDnsResolver();
DefaultSchemePortResolver schemePortResolver = prepareSchemePortResolver();
BasicHttpClientConnectionManager connManager = prepareConnectionManager(dnsResolver, schemePortResolver);
HttpClient httpClient = prepareHttpClient(connManager);
originalHttpClient = (HttpClient) Options.getOption(Option.HTTPCLIENT);
Unirest.setHttpClient(httpClient);
}
开发者ID:bastion-dev,项目名称:Bastion,代码行数:10,代码来源:TestWithProxiedEmbeddedServer.java
示例3: setTimeouts
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
/**
* Set the connection timeout and socket timeout
*/
public static void setTimeouts(long connectionTimeout, long socketTimeout) {
Options.setOption(Option.CONNECTION_TIMEOUT, connectionTimeout);
Options.setOption(Option.SOCKET_TIMEOUT, socketTimeout);
// Reload the client implementations
Options.refresh();
}
开发者ID:zeeshanejaz,项目名称:unirest-android,代码行数:11,代码来源:Unirest.java
示例4: setDefaultHeader
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
/**
* Set default header
*/
@SuppressWarnings("unchecked")
public static void setDefaultHeader(String name, String value) {
Object headers = Options.getOption(Option.DEFAULT_HEADERS);
if (headers == null) {
headers = new HashMap<String, String>();
}
((Map<String, String>) headers).put(name, value);
Options.setOption(Option.DEFAULT_HEADERS, headers);
}
开发者ID:zeeshanejaz,项目名称:unirest-android,代码行数:13,代码来源:Unirest.java
示例5: refreshUnirestConnection
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
private void refreshUnirestConnection() {
Connection.closeAll();
Options.refresh();
}
开发者ID:Invoiced,项目名称:invoiced-java,代码行数:5,代码来源:Connection.java
示例6: getHttpClient
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
public static HttpClient getHttpClient() {
return (HttpClient) Options.getOption(Option.HTTPCLIENT);
}
开发者ID:zeeshanejaz,项目名称:unirest-android,代码行数:4,代码来源:ClientFactory.java
示例7: getAsyncHttpClient
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
public static CloseableHttpAsyncClient getAsyncHttpClient() {
return (CloseableHttpAsyncClient) Options.getOption(Option.ASYNCHTTPCLIENT);
}
开发者ID:zeeshanejaz,项目名称:unirest-android,代码行数:4,代码来源:ClientFactory.java
示例8: setHttpClient
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
/**
* Set the HttpClient implementation to use for every synchronous request
*/
public static void setHttpClient(HttpClient httpClient) {
Options.setOption(Option.HTTPCLIENT, httpClient);
}
开发者ID:zeeshanejaz,项目名称:unirest-android,代码行数:7,代码来源:Unirest.java
示例9: clearDefaultHeaders
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
/**
* Clear default headers
*/
public static void clearDefaultHeaders() {
Options.setOption(Option.DEFAULT_HEADERS, null);
}
开发者ID:zeeshanejaz,项目名称:unirest-android,代码行数:7,代码来源:Unirest.java
示例10: setAsyncHttpClient
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
/**
* Set the asynchronous AbstractHttpAsyncClient implementation to use for every asynchronous request
*/
public static void setAsyncHttpClient(CloseableHttpAsyncClient asyncHttpClient) {
Options.setOption(Option.ASYNCHTTPCLIENT, asyncHttpClient);
}
开发者ID:zeeshanejaz,项目名称:unirest-android,代码行数:7,代码来源:Unirest.java
示例11: shutdown
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
/**
* Close the asynchronous client and its event loop. Use this method to close all the threads and allow an application to exit.
*/
public static void shutdown() throws IOException {
CloseableHttpAsyncClient asyncClient = (CloseableHttpAsyncClient) Options.getOption(Option.ASYNCHTTPCLIENT);
if (asyncClient.isRunning()) asyncClient.close();
}
开发者ID:zeeshanejaz,项目名称:unirest-android,代码行数:8,代码来源:Unirest.java
示例12: startup
import com.mashape.unirest.http.options.Options; //导入依赖的package包/类
/**
* With some frameworks it is necessary to refresh the unirest connection pool state
* during runtime. This method does just that.
*/
public void startup() {
Options.refresh();
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:8,代码来源:Consul.java
注:本文中的com.mashape.unirest.http.options.Options类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论