Search in sources :

Example 1 with Configurable

use of org.apache.hc.client5.http.config.Configurable in project feign by OpenFeign.

the class ApacheHttp5Client method configureTimeouts.

protected HttpClientContext configureTimeouts(Request.Options options) {
    final HttpClientContext context = new HttpClientContext();
    // per request timeouts
    final RequestConfig requestConfig = (client instanceof Configurable ? RequestConfig.copy(((Configurable) client).getConfig()) : RequestConfig.custom()).setConnectTimeout(options.connectTimeout(), options.connectTimeoutUnit()).setResponseTimeout(options.readTimeout(), options.readTimeoutUnit()).build();
    context.setRequestConfig(requestConfig);
    return context;
}
Also used : RequestConfig(org.apache.hc.client5.http.config.RequestConfig) HttpClientContext(org.apache.hc.client5.http.protocol.HttpClientContext) Configurable(org.apache.hc.client5.http.config.Configurable)

Example 2 with Configurable

use of org.apache.hc.client5.http.config.Configurable in project feign by OpenFeign.

the class AsyncApacheHttp5Client method configureTimeouts.

protected HttpClientContext configureTimeouts(Request.Options options, HttpClientContext context) {
    // per request timeouts
    final RequestConfig requestConfig = (client instanceof Configurable ? RequestConfig.copy(((Configurable) client).getConfig()) : RequestConfig.custom()).setConnectTimeout(options.connectTimeout(), options.connectTimeoutUnit()).setResponseTimeout(options.readTimeout(), options.readTimeoutUnit()).build();
    context.setRequestConfig(requestConfig);
    return context;
}
Also used : RequestConfig(org.apache.hc.client5.http.config.RequestConfig) Configurable(org.apache.hc.client5.http.config.Configurable)

Aggregations

Configurable (org.apache.hc.client5.http.config.Configurable)2 RequestConfig (org.apache.hc.client5.http.config.RequestConfig)2 HttpClientContext (org.apache.hc.client5.http.protocol.HttpClientContext)1