Example usage for org.apache.http.impl.client ClientParamsStack ClientParamsStack

List of usage examples for org.apache.http.impl.client ClientParamsStack ClientParamsStack

Introduction

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

Prototype

public ClientParamsStack(final HttpParams aparams, final HttpParams cparams, final HttpParams rparams,
        final HttpParams oparams) 

Source Link

Document

Creates a new parameter stack from elements.

Usage

From source file:org.vietspider.net.client.impl.AbstractHttpClient.java

/**
 * Obtains parameters for executing a request.
 * The default implementation in this class creates a new
 * {@link ClientParamsStack} from the request parameters
 * and the client parameters./*from  ww  w  . jav  a2 s  .  c  o  m*/
 * <br/>
 * This method is called by the default implementation of
 * {@link #execute(HttpHost,HttpRequest,HttpContext)}
 * to obtain the parameters for the
 * {@link DefaultRequestDirector}.
 *
 * @param req    the request that will be executed
 *
 * @return  the parameters to use
 */
protected HttpParams determineParams(HttpRequest req) {
    return new ClientParamsStack(null, getParams(), req.getParams(), null);
}

From source file:org.apache.http.impl.client.AbstractHttpClient.java

/**
 * Obtains parameters for executing a request.
 * The default implementation in this class creates a new
 * {@link ClientParamsStack} from the request parameters
 * and the client parameters.//from   ww w.  jav  a 2  s  .com
 * <br/>
 * This method is called by the default implementation of
 * {@link #execute(HttpHost,HttpRequest,HttpContext)}
 * to obtain the parameters for the
 * {@link DefaultRequestDirector}.
 *
 * @param req    the request that will be executed
 *
 * @return  the parameters to use
 */
protected HttpParams determineParams(final HttpRequest req) {
    return new ClientParamsStack(null, getParams(), req.getParams(), null);
}

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

public synchronized void start() {
    try {//from w  w  w . jav  a  2  s  .  co 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);
    }
}