Examples of HttpClientFactory


Examples of org.apache.tuscany.sca.host.http.client.HttpClientFactory

        put.addHeader("Title", "Title " + receiptName + "");
        put.addHeader("Slug", "Slug " + receiptName + "");
        put.setEntity(new FileEntity(input, "image/jpg"));

        // Get HTTP client
        HttpClient httpclient = new HttpClientFactory().createHttpClient();
        try {
            // Execute request
            HttpResponse response = httpclient.execute(put);
            response.getEntity().consumeContent();
            int result = response.getStatusLine().getStatusCode();
View Full Code Here

Examples of org.apache.tuscany.sca.host.http.client.HttpClientFactory

        put.addHeader("Title", "Title " + receiptName + "");
        put.addHeader("Slug", "Slug " + receiptName + "");
        put.setEntity(new FileEntity(input, "image/jpg"));

        // Get HTTP client
        HttpClient httpclient = new HttpClientFactory().createHttpClient();
        try {
            // Execute request
            HttpResponse response = httpclient.execute(put);
            int result = response.getStatusLine().getStatusCode();
            // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6)
View Full Code Here

Examples of org.openqa.selenium.remote.internal.HttpClientFactory

  private final HttpClientFactory httpClientFactory;
  private boolean run = true;

  public StoppableRegisteringRemote(RegistrationRequest config) {
    this.nodeConfig = config;
    this.httpClientFactory = new HttpClientFactory();
  }
View Full Code Here

Examples of org.openqa.selenium.remote.internal.HttpClientFactory

    commandCodec = new JsonHttpCommandCodec();
    responseCodec = new JsonHttpResponseCodec();

    synchronized (FastHttpCommandExecutor.class) {
      if (httpClientFactory == null) {
        httpClientFactory = new HttpClientFactory();
      }
    }

    if (addressOfRemoteServer != null && addressOfRemoteServer.getUserInfo() != null) {
      // Use HTTP Basic auth
View Full Code Here

Examples of org.owasp.webscarab.httpclient.HTTPClientFactory

        addConversation(id, new Date(), request, response, origin);
        return id;
    }
   
    private void configureHTTPClient() {
        HTTPClientFactory factory = HTTPClientFactory.getInstance();
        String prop = null;
        String value;
        int colon;
        try {
            // FIXME for some reason, we get "" instead of null for value,
            // and do not use our default value???
            prop = "WebScarab.httpProxy";
            value = Preferences.getPreference(prop);
            if (value == null || value.equals("")) value = ":3128";
            colon = value.indexOf(":");
            factory.setHttpProxy(value.substring(0,colon), Integer.parseInt(value.substring(colon+1).trim()));
           
            prop = "WebScarab.httpsProxy";
            value = Preferences.getPreference(prop);
            if (value == null || value.equals("")) value = ":3128";
            colon = value.indexOf(":");
            factory.setHttpsProxy(value.substring(0,colon), Integer.parseInt(value.substring(colon+1).trim()));
           
            prop = "WebScarab.noProxy";
            value = Preferences.getPreference(prop, "");
            if (value == null) value = "";
            factory.setNoProxy(value.split(" *, *"));
           
            int connectTimeout = 30000;
            prop = "HttpClient.connectTimeout";
            value = Preferences.getPreference(prop,"");
            if (value != null && !value.equals("")) {
                try {
                    connectTimeout = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {}
            }
            int readTimeout = 0;
            prop = "HttpClient.readTimeout";
            value = Preferences.getPreference(prop,"");
            if (value != null && !value.equals("")) {
                try {
                    readTimeout = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {}
            }
            factory.setTimeouts(connectTimeout, readTimeout);
           
        } catch (NumberFormatException nfe) {
            _logger.warning("Error parsing property " + prop + ": " + nfe);
        } catch (Exception e) {
            _logger.warning("Error configuring the HTTPClient property " + prop + ": " + e);
        }
        factory.setAuthenticator(_credentialManager);
    }
View Full Code Here

Examples of org.owasp.webscarab.httpclient.HTTPClientFactory

        addConversation(id, new Date(), request, response, origin);
        return id;
    }
   
    private void configureHTTPClient() {
        HTTPClientFactory factory = HTTPClientFactory.getInstance();
        String prop = null;
        String value;
        int colon;
        try {
            // FIXME for some reason, we get "" instead of null for value,
            // and do not use our default value???
            prop = "WebScarab.httpProxy";
            value = Preferences.getPreference(prop);
            if (value == null || value.equals("")) value = ":3128";
            colon = value.indexOf(":");
            factory.setHttpProxy(value.substring(0,colon), Integer.parseInt(value.substring(colon+1).trim()));
           
            prop = "WebScarab.httpsProxy";
            value = Preferences.getPreference(prop);
            if (value == null || value.equals("")) value = ":3128";
            colon = value.indexOf(":");
            factory.setHttpsProxy(value.substring(0,colon), Integer.parseInt(value.substring(colon+1).trim()));
           
            prop = "WebScarab.noProxy";
            value = Preferences.getPreference(prop, "");
            if (value == null) value = "";
            factory.setNoProxy(value.split(" *, *"));
           
            int connectTimeout = 30000;
            prop = "HttpClient.connectTimeout";
            value = Preferences.getPreference(prop,"");
            if (value != null && !value.equals("")) {
                try {
                    connectTimeout = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {}
            }
            int readTimeout = 0;
            prop = "HttpClient.readTimeout";
            value = Preferences.getPreference(prop,"");
            if (value != null && !value.equals("")) {
                try {
                    readTimeout = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {}
            }
            factory.setTimeouts(connectTimeout, readTimeout);
           
        } catch (NumberFormatException nfe) {
            _logger.warning("Error parsing property " + prop + ": " + nfe);
        } catch (Exception e) {
            _logger.warning("Error configuring the HTTPClient property " + prop + ": " + e);
        }
        factory.setAuthenticator(_credentialManager);
    }
View Full Code Here

Examples of org.sonatype.nexus.httpclient.HttpClientFactory

  }

  private KenaiRealm getRealm()
      throws Exception
  {
    final HttpClientFactory mockHttpClientFactory = Mockito.mock(HttpClientFactory.class);
    Mockito.when(mockHttpClientFactory.create()).thenReturn(new DefaultHttpClient());
    return new KenaiRealm(getKenaiRealmConfiguration(), mockHttpClientFactory);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.