Example usage for org.apache.http.impl.nio.client ParamConfig getRequestConfig

List of usage examples for org.apache.http.impl.nio.client ParamConfig getRequestConfig

Introduction

In this page you can find the example usage for org.apache.http.impl.nio.client ParamConfig getRequestConfig.

Prototype

@SuppressWarnings("unchecked")
    public static RequestConfig getRequestConfig(final HttpParams params) 

Source Link

Usage

From source file:org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.java

public synchronized void start() {
    try {//from   w  ww  .j ava  2  s.  c  o m
        if (this.log.isDebugEnabled()) {
            this.log.debug("[exchange: " + this.id + "] start execution");
        }
        this.localContext.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetAuthState);
        this.localContext.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyAuthState);

        final HttpHost target = this.requestProducer.getTarget();
        final HttpRequest request = this.requestProducer.generateRequest();
        if (request instanceof AbortableHttpRequest) {
            ((AbortableHttpRequest) request).setReleaseTrigger(new ConnectionReleaseTrigger() {

                @Override
                public void releaseConnection() throws IOException {
                }

                @Override
                public void abortConnection() throws IOException {
                    cancel();
                }

            });
        }
        this.params = new ClientParamsStack(null, this.clientParams, request.getParams(), null);
        final RequestWrapper wrapper = wrapRequest(request);
        wrapper.setParams(this.params);
        final HttpRoute route = determineRoute(target, wrapper, this.localContext);
        this.mainRequest = new RoutedRequest(wrapper, route);
        final RequestConfig config = ParamConfig.getRequestConfig(params);
        this.localContext.setAttribute(ClientContext.REQUEST_CONFIG, config);
        this.requestContentProduced = false;
        requestConnection();
    } catch (final Exception ex) {
        failed(ex);
    }
}