Package org.apache.commons.httpclient.params

Examples of org.apache.commons.httpclient.params.HttpConnectionParams


   * @param password can be NULL
   * @return HttpClient
   */
  public static HttpClient getHttpClientInstance(String user, String password) {
    HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
    HttpConnectionParams params = connectionManager.getParams();
    // wait max 10 seconds to establish connection
    params.setConnectionTimeout(10000);
    // a read() call on the InputStream associated with this Socket
    // will block for only this amount
    params.setSoTimeout(10000);
    HttpClient c = new HttpClient(connectionManager);

    // use basic authentication if available
    if (user != null && user.length() > 0) {
      AuthScope authScope = new AuthScope(null, -1, null);
View Full Code Here


     *
     * @return the generated HttpClient
     */
    public HttpClient buildClient() {
        HttpClient httpClient = new HttpClient();
        HttpConnectionParams params = httpClient.getHttpConnectionManager().getParams();
        params.setConnectionTimeout(backendTimeoutMillis);
        params.setSoTimeout(backendTimeoutMillis);

        if (authscope != null && httpcredentials != null) {
            httpClient.getState().setCredentials(authscope, httpcredentials);
            httpClient.getParams().setAuthenticationPreemptive(true);
        }
View Full Code Here

    static public HttpMethod apiRequest(HttpMethod method, IContext context, String host) throws IOException, IllegalArgumentException {
        Flog.info("Sending an API request");
        final HttpClient client = new HttpClient();
        // NOTE: we cant tell java to follow redirects because they can fail.
        HttpConnectionManager connectionManager = client.getHttpConnectionManager();
        HttpConnectionParams connectionParams = connectionManager.getParams();
        connectionParams.setParameter("http.protocol.handle-redirects", true);
        connectionParams.setSoTimeout(5000);
        connectionParams.setConnectionTimeout(3000);
        connectionParams.setIntParameter(HttpMethodParams.BUFFER_WARN_TRIGGER_LIMIT, 1024 * 1024);
        FloorcJson floorcJson = null;
        try {
            floorcJson = Settings.get();
        } catch (Throwable e) {
            Flog.warn(e);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.params.HttpConnectionParams

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.