Package org.apache.http.impl.client

Examples of org.apache.http.impl.client.DefaultHttpClient


    // Increase default max connection per route to 20
    //cm.setDefaultMaxPerRoute(20);
    // Increase max connections for localhost:80 to 50
    //HttpHost localhost = new HttpHost("locahost", 80);
    //cm.setMaxPerRoute(new HttpRoute(localhost), 50);
    client =  new DefaultHttpClient(connectionManager);
  }
View Full Code Here


        poolingClientConnectionManager.setMaxTotal(settings.getAsInt("http.client.max_total", 100));
        poolingClientConnectionManager.setDefaultMaxPerRoute(settings.getAsInt("http.client.default_max_per_route", 50));
        final HttpParams httpParams = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(httpParams, settings.getAsInt("http.client.connect.timeout", 5000));
        HttpConnectionParams.setSoTimeout(httpParams, settings.getAsInt("http.client.accept.timeout", 5000));
        httpClient = new DefaultHttpClient(poolingClientConnectionManager, httpParams);
    }
View Full Code Here

      this.metadataRetriever = metadataRetriever;
    }

    public void initializeClient(String username, String password) {
        //this.layerName = null;
        DefaultHttpClient httpclient = new DefaultHttpClient();
        HttpHost targetHost = new HttpHost(this.serverName, 80, "http");
       
        if (!(username.isEmpty() && password.isEmpty())){
          this.credentials = new UsernamePasswordCredentials(username, password);

          httpclient.getCredentialsProvider().setCredentials(
                new AuthScope(AuthScope.ANY),
                this.credentials);
       
          // Create AuthCache instance
          AuthCache authCache = new BasicAuthCache();
View Full Code Here

  /** Called from {@link #init(javax.servlet.ServletConfig)}. HttpClient offers many opportunities for customization.
* @param hcParams*/
  @SuppressWarnings("deprecation")
protected HttpClient createHttpClient(HttpParams hcParams) {
    return new DefaultHttpClient(new ThreadSafeClientConnManager(),hcParams);
  }
View Full Code Here

        return result;
    }
   
    @Before
    public void setupHttpClient() {
        client = new DefaultHttpClient();
    }
View Full Code Here

        assertNull(TEST_SYSTEM_PROPERTY + " should not be set before tests", System.getProperty(TEST_SYSTEM_PROPERTY));
    }
   
    @BeforeClass
    public static void setup() {
        client = new DefaultHttpClient();
        final HttpUriRequest get = new HttpGet(baseUrl);
        System.setProperty("http.port", String.valueOf(port));
        System.setProperty("osgi.storage.path", getOsgiStoragePath());
       
        final InputStream is = CrankstartBootstrapTest.class.getResourceAsStream(TEST_RESOURCE);
View Full Code Here

    public RequestExecutor runTests(String testClassesSelector, String testMethodSelector, String extension, Map<String, String> requestOptions)
    throws ClientProtocolException, IOException {
        final RequestBuilder builder = new RequestBuilder(junitServletUrl);

        // Optionally let the client to consume the response entity
        final RequestExecutor executor = new RequestExecutor(new DefaultHttpClient()) {
            @Override
            protected void consumeEntity() throws ParseException, IOException {
                if(consumeContent) {
                    super.consumeEntity();
                }
View Full Code Here

    httpsSource.stop();
  }

  @Before
  public void setUp() {
    httpClient = new DefaultHttpClient();
    postRequest = new HttpPost("http://0.0.0.0:" + selectedPort);
  }
View Full Code Here

      }
    }
    this.serializer = serializer;

    serversList = new RoundRobinList<String>(Arrays.asList(hostNames));
    httpClient = new DefaultHttpClient();
    bulkBuilder = new StringBuilder();
  }
View Full Code Here

    tokenRequest.setEntity(new ByteArrayEntity(postBody.getBytes()));
    tokenRequest.addHeader("Authorization", AuthorizationCodeTestIT.authorizationBasic(clientId, secret));

    tokenRequest.addHeader("Content-Type", "application/x-www-form-urlencoded");

    HttpResponse tokenHttpResponse = new DefaultHttpClient().execute(tokenRequest);
    final InputStream responseContent = tokenHttpResponse.getEntity().getContent();
    String responseAsString = IOUtils.toString(responseContent);

    AccessTokenResponse refreshTokenResponse = getMapper().readValue(responseAsString, AccessTokenResponse.class);
View Full Code Here

TOP

Related Classes of org.apache.http.impl.client.DefaultHttpClient

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.