Examples of ApacheHttpClient4Executor


Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

          "/twitter.properties").getFile());
      props.load(new FileInputStream(propFile));
      oauthHelper = new TwitterClientOAuthHelper(props, propFile);

      RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
      final ClientExecutor clientExecutor = new ApacheHttpClient4Executor(
          createClient());
      twitter = ProxyFactory.create(TwitterResource.class,
          "http://api.twitter.com/1", clientExecutor);

    } catch (FileNotFoundException e) {
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor


   @Test
   public void testStreamStillOpen() throws Exception
   {
      final ApacheHttpClient4Executor executor = createClient();
      final MyResource proxy = ProxyFactory.create(MyResource.class, "http://localhost:8081", executor);
      boolean failed = true;
      try
      {
         String str = proxy.error();
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

      // This connection manager must be used if more than one thread will
      // be using the HttpClient.
      ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
      HttpClient httpClient = new DefaultHttpClient(cm, params);

      final ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(httpClient);
      return executor;
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

    private final ClientExecutor executor;
    private final ClientRequestFactory clientRequestFactory;

    public RestfulClient(final URI baseUri) {
        this(baseUri, new ApacheHttpClient4Executor(new DefaultHttpClient()));
    }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

                throw new RuntimeException("Cannot substitute annotations for method " + method.getName(), e);
            }
            final ProxyBuilder<?> proxyBuilder = ProxyBuilder.build(parameterType, getBaseURL() + resourcePath);
            final Map<String, String> headers = getHeaders(clazz, method);
            if (!headers.isEmpty()) {
                proxyBuilder.executor(new ApacheHttpClient4Executor() {
                    @Override
                    public ClientResponse execute(ClientRequest request) throws Exception
                    {
                        for (Map.Entry<String, String> entry : headers.entrySet()) {
                            request.header(entry.getKey(), entry.getValue());
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

    /**
     * Using {@link ApacheHttpClient4Executor} and specified {@link HttpClient}.
     */
    public RestfulClient(final URI baseUri, HttpClient client) {
        this(baseUri, new ApacheHttpClient4Executor(client));
    }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

        schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));

        ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
        HttpClient httpClient = new DefaultHttpClient(cm, params);

        return new ApacheHttpClient4Executor(httpClient);
    }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

        }
        PoolingClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
        cm.setMaxTotal(200);
        cm.setDefaultMaxPerRoute(20);
        HttpClient httpClient = new DefaultHttpClient(cm);
        _executor = new ApacheHttpClient4Executor(httpClient);

        // Authentication settings
        if (model.hasAuthentication()) {
            // Set authentication
            AuthScope authScope = null;
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

                    new UsernamePasswordCredentials(username, password)
            );

            DefaultHttpClient client = new DefaultHttpClient();
            client.setCredentialsProvider(credentialsProvider);
            ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(client);
            return new ClientRequest(uri, executor).accept(mediaType);
        }
    }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor

            credentialsProvider.setCredentials(
                    new AuthScope(uri.getHost(), uri.getPort()),
                    new UsernamePasswordCredentials(DEFAULT_USERNAME, DEFAULT_PASSWORD)
            );
            HttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build();
            ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(client);
            return new ClientRequest(uriString, executor);
        }
    }
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.