Example usage for org.apache.commons.httpclient MultiThreadedHttpConnectionManager MultiThreadedHttpConnectionManager

List of usage examples for org.apache.commons.httpclient MultiThreadedHttpConnectionManager MultiThreadedHttpConnectionManager

Introduction

In this page you can find the example usage for org.apache.commons.httpclient MultiThreadedHttpConnectionManager MultiThreadedHttpConnectionManager.

Prototype

public MultiThreadedHttpConnectionManager() 

Source Link

Usage

From source file:org.springframework.http.client.CommonsClientHttpRequestFactory.java

/**
 * Create a new instance of the {@code CommonsHttpRequestFactory} with a default
 * {@link HttpClient} that uses a default {@link MultiThreadedHttpConnectionManager}.
 *///  w  ww  .  ja v a 2s  .  com
public CommonsClientHttpRequestFactory() {
    this.httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
    this.setReadTimeout(DEFAULT_READ_TIMEOUT_MILLISECONDS);
}

From source file:org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor.java

/**
 * Create a new CommonsHttpInvokerRequestExecutor with a default
 * HttpClient that uses a default MultiThreadedHttpConnectionManager.
 * @see org.apache.commons.httpclient.HttpClient
 * @see org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
 *///from ww w  .  j av a2 s . c  o  m
public CommonsHttpInvokerRequestExecutor() {
    this.httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
}

From source file:org.springframework.ws.transport.http.CommonsHttpConnection.java

@Override
protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
    postMethod.setRequestEntity(new ByteArrayRequestEntity(requestBuffer.toByteArray()));
    requestBuffer = null;//from   w ww .  ja v a2 s .  c o  m
    try {
        httpClient.executeMethod(postMethod);
    } catch (IllegalStateException ex) {
        if ("Connection factory has been shutdown.".equals(ex.getMessage())) {
            // The application context has been closed, resulting in a connection factory shutdown and an ISE.
            // Let's create a new connection factory for this connection only.
            connectionManager = new MultiThreadedHttpConnectionManager();
            httpClient.setHttpConnectionManager(connectionManager);
            httpClient.executeMethod(postMethod);
        } else {
            throw ex;
        }
    }
}

From source file:org.springframework.ws.transport.http.CommonsHttpMessageSender.java

/**
 * Create a new instance of the <code>CommonsHttpMessageSender</code> with a default {@link HttpClient} that uses a
 * default {@link MultiThreadedHttpConnectionManager}.
 *//*  w w  w  .  j a v  a 2  s  .c  o  m*/
public CommonsHttpMessageSender() {
    httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
    setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS);
    setReadTimeout(DEFAULT_READ_TIMEOUT_MILLISECONDS);
}

From source file:org.springside.fi.common.httpclient.AbstractHttpClientTemplate.java

/**
 * Implementation of <code>InitializingBean</code> 
 * that initializes the <code>HttpClient</code> if it is <code>null</code> 
 * and also sets the connection manager to <code>MultiThreadedHttpConnectionManager</code> 
 * if it is <code>null</code> while initializing the <code>HttpClient</code>.
 *///  w ww.  j a va  2  s  . c om
public void afterPropertiesSet() throws Exception {

    if (client == null) {
        if (connectionManager == null) {
            connectionManager = new MultiThreadedHttpConnectionManager();
        }

        client = new HttpClient(connectionManager);
    }

    client.getParams().setAuthenticationPreemptive(authenticationPreemptive);
}

From source file:org.svenk.redmine.core.client.AbstractRedmineClient.java

public AbstractRedmineClient(AbstractWebLocation location, RedmineClientData clientData,
        TaskRepository repository) {//from  w w  w  .j  a v a 2s  .c o m
    this.data = clientData;

    MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
    this.httpClient = new HttpClient(connectionManager);
    this.httpClient.getParams().setCookiePolicy(CookiePolicy.RFC_2109);

    refreshRepositorySettings(repository, location);

    createResponseParsers();
}

From source file:org.tinygroup.httpvisit.impl.HttpVisitorImpl.java

public void init() {
    client = new HttpClient(new MultiThreadedHttpConnectionManager());
    client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout);
    client.getParams().setCookiePolicy(CookiePolicy.RFC_2109);
    client.setState(httpState);//from  w w  w  .j a va 2s .co m
    if (authPrefs != null) {
        client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
    }
    if (proxyHost != null) {
        client.getHostConfiguration().setProxy(proxyHost, proxyPort);
        if (proxyUserPassword != null) {
            httpState.setProxyCredentials(new AuthScope(proxyHost, proxyPort), proxyUserPassword);
        }
    }
}

From source file:org.wannatrak.device.api.ApiIntegrationTest.java

@BeforeTest
public void beforeTest() throws URISyntaxException {
    RegisterBuiltin.register(ResteasyProviderFactory.getInstance());

    final ClientRequestFactory clientRequestFactory = new ClientRequestFactory(
            new ApacheHttpClientExecutor(new HttpClient(new MultiThreadedHttpConnectionManager())),
            new URI("http://localhost:9095/api")
    //                new URI("http://localhost:8080/device/api")
    );/*from  w  w w  .j a  v a  2  s  .c  om*/
    api = clientRequestFactory.createProxy(Api.class);
}

From source file:org.wannatrak.device.api.TrakApiIntegrationTest.java

@BeforeTest
public void beforeTest() throws URISyntaxException {
    RegisterBuiltin.register(ResteasyProviderFactory.getInstance());

    final ClientRequestFactory clientRequestFactory = new ClientRequestFactory(
            new ApacheHttpClientExecutor(new HttpClient(new MultiThreadedHttpConnectionManager())),
            //                new URI("http://localhost:9095/api")
            new URI("http://localhost:8080/device/api")
    //                new URI("http://www.wannatrak.com/device/api")
    );// w  w w.ja v a2 s  .c  o  m
    api = clientRequestFactory.createProxy(Api.class);
    trakApi = clientRequestFactory.createProxy(TrakApi.class);
}

From source file:org.waveprotocol.box.server.robots.RobotApiModule.java

@Provides
@Singleton/*from   w  w  w .  j  av a  2  s  .c  o m*/
protected RobotConnection provideRobotConnection() {
    HttpClient httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());

    ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("RobotConnection").build();
    return new HttpRobotConnection(httpClient, Executors.newFixedThreadPool(NUMBER_OF_THREADS, threadFactory));
}