Package org.jboss.resteasy.client.jaxrs.engines

Examples of org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine


    BasicHttpContext localContext = new BasicHttpContext();
    localContext.setAttribute( ClientContext.AUTH_CACHE, authCache );

    return new ResteasyClientBuilder()
    .httpEngine( new ApacheHttpClient4Engine( httpClient, localContext ) )
    .build();
  }
View Full Code Here


         if (connectionCheckoutTimeoutMs > -1)
         {
             HttpClientParams.setConnectionManagerTimeout(params, connectionCheckoutTimeoutMs);
         }
         httpClient = new DefaultHttpClient(cm, params);
         ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient, true);
         engine.setResponseBufferSize(responseBufferSize);
         engine.setHostnameVerifier(verifier);
         // this may be null.  We can't really support this with Apache Client.
         engine.setSslContext(theContext);
         engine.setDefaultProxy(defaultProxy);
         return engine;
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
View Full Code Here

      HttpClient httpClient = new DefaultHttpClient(cm, params);

       final ClientHttpEngine executor;

      if (clazz.isAssignableFrom(ApacheHttpClient4Engine.class)) {
          executor = new ApacheHttpClient4Engine(httpClient);
      } else {
          executor = new URLConnectionEngine();
      }

View Full Code Here

    * org.apache.http.conn.ClientConnectionManager.
    */
   @Test
   public void testApacheHttpClient4ExecutorNonSharedHttpClientFinalize() throws Throwable
   {
      ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine();
      ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
      Response response = client.target(generateURL("/test")).request().post(null);
      Assert.assertEquals(204, response.getStatus());
      engine.finalize();
      HttpClient httpClient = engine.getHttpClient();
      HttpPost post = new HttpPost(generateURL("/test"));
      try
      {
         httpClient.execute(post);
         fail("Expected IllegalStateException");
View Full Code Here

    * org.apache.http.conn.ClientConnectionManager.
    */
   @Test
   public void testApacheHttpClient4ExecutorNonSharedHttpClientClose() throws Throwable
   {
      ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine();
      ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
      Response response = client.target(generateURL("/test")).request().post(null);
      Assert.assertEquals(204, response.getStatus());
      engine.close();
      HttpClient httpClient = engine.getHttpClient();
      HttpPost post = new HttpPost(generateURL("/test"));
      try
      {
         httpClient.execute(post);
         fail("Expected IllegalStateException");
View Full Code Here

    */
   @Test
   public void testApacheHttpClient4ExecutorSharedHttpClientFinalize() throws Throwable
   {
      HttpClient httpClient = new DefaultHttpClient();
      ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);
      ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
      Response response = client.target(generateURL("/test")).request().post(null);
      Assert.assertEquals(204, response.getStatus());
      engine.finalize();
      Assert.assertEquals(httpClient, engine.getHttpClient());
      HttpPost post = new HttpPost(generateURL("/test"));
      HttpResponse httpResponse = httpClient.execute(post);
      Assert.assertEquals(204, httpResponse.getStatusLine().getStatusCode());
      httpClient.getConnectionManager().shutdown();
   }
View Full Code Here

    */
   @Test
   public void testApacheHttpClient4ExecutorSharedHttpClientClose() throws Throwable
   {
      HttpClient httpClient = new DefaultHttpClient();
      ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);
      ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
      Response response = client.target(generateURL("/test")).request().post(null);
      Assert.assertEquals(204, response.getStatus());
      engine.close();
      Assert.assertEquals(httpClient, engine.getHttpClient());
      HttpPost post = new HttpPost(generateURL("/test"));
      HttpResponse httpResponse = httpClient.execute(post);
      Assert.assertEquals(204, httpResponse.getStatusLine().getStatusCode());
      httpClient.getConnectionManager().shutdown();
   }
View Full Code Here

                @Override
                public void clear() {
                    //To change body of implemented methods use File | Settings | File Templates.
                }
            });
            ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);
            this.client = new ResteasyClientBuilder().httpEngine(engine).build();
        }
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine

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.