Package org.jboss.resteasy.client

Examples of org.jboss.resteasy.client.ClientExecutor


         HttpResponse response = client.execute(method);
         Assert.assertEquals(403, response.getStatusLine().getStatusCode());
         EntityUtils.consume(response.getEntity());
      }

      ClientExecutor executor = createAuthenticatingExecutor(client);
     
      {
         UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("bill", "password");
         client.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), credentials);
         ClientRequest request = new ClientRequest(generateURL("/secured/authorized"), executor);
View Full Code Here


      ClientResponse<?> response1 = request1.post();
      Assert.assertEquals(204, response1.getStatus());
      ClientRequest request2 = new ClientRequest(generateURL("/test"));
      ClientResponse<?> response2 = request2.post();
      Assert.assertEquals(204, response2.getStatus());
      ClientExecutor executor1 = request1.getExecutor();
      ClientExecutor executor2 = request2.getExecutor();
      Assert.assertNotSame(executor1, executor2);
      executor2.close();
      response1 = request1.post();
      Assert.assertEquals(204, response1.getStatus());
      executor1.close();

   }
View Full Code Here

    * supplied through a constructor.
    */
   @Test
   public void testClientRequestSharedExecutor() throws Exception
   {
      ClientExecutor executor = new ApacheHttpClient4Executor();
      ClientRequest request1 = new ClientRequest(generateURL("/test"), executor);
      ClientResponse<?> response1 = request1.post();
      Assert.assertEquals(204, response1.getStatus());
      ClientRequest request2 = new ClientRequest(generateURL("/test"), executor);
      ClientResponse<?> response2 = request2.post();
      Assert.assertEquals(204, response2.getStatus());
      ClientExecutor executor1 = request1.getExecutor();
      ClientExecutor executor2 = request2.getExecutor();
      Assert.assertSame(executor, executor1);
      Assert.assertSame(executor, executor2);
      executor.close();
   }
View Full Code Here

   @Test
   public void testIt()
   {
      UriBuilder uriBuilder = new ResteasyUriBuilder().uriTemplate("/");
      ClientExecutor executor = ClientRequest.getDefaultExecutor();
      ClientRequest request = new ClientRequest(uriBuilder, executor);
      _test(request, uriBuilder, "/set");
      _test(request, uriBuilder, "/headers");
      _test(request, uriBuilder, "/headers/fromField");
      _test(request, uriBuilder, "/cookieparam");
View Full Code Here

   @Test
   public void testStreamClosedWhenGetEntity() throws Exception
   {
      HttpClient httpClient = new DefaultHttpClient();
      ClientExecutor clientExecutor = new ApacheHttpClient4Executor(httpClient);

      ResteasyProviderFactory pf = ResteasyProviderFactory.getInstance();
      pf.addClientErrorInterceptor(new MyClienteErrorInterceptor());

      MyResource proxy = ProxyFactory.create(MyResource.class, URI.create(generateBaseUrl()), clientExecutor, pf);
View Full Code Here

   @Test
   public void testStreamClosedWhenGetEntityForVoid() throws Exception
   {
      HttpClient httpClient = new DefaultHttpClient();
      ClientExecutor clientExecutor = new ApacheHttpClient4Executor(httpClient);

      ResteasyProviderFactory pf = ResteasyProviderFactory.getInstance();
      pf.addClientErrorInterceptor(new MyClienteErrorInterceptor());

      MyResource proxy = ProxyFactory.create(MyResource.class, URI.create(generateBaseUrl()), clientExecutor, pf);
View Full Code Here

   public void testProxy() throws Exception
   {
      DefaultHttpClient client = new DefaultHttpClient();
      UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("bill", "password");
      client.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), credentials);
      ClientExecutor executor = createAuthenticatingExecutor(client);
      BaseProxy proxy = ProxyFactory.create(BaseProxy.class, generateURL(""), executor);
      String val = proxy.get();
      Assert.assertEquals(val, "hello");
      val = proxy.getAuthorized();
      Assert.assertEquals(val, "authorized");
View Full Code Here

   public void testSecurity() throws Exception
   {
      DefaultHttpClient client = new DefaultHttpClient();
      UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("bill", "password");
      client.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), credentials);
      ClientExecutor executor = createAuthenticatingExecutor(client);
      {
         ClientRequest request = new ClientRequest(generateURL("/secured"), executor);
         ClientResponse<String> response = request.get(String.class);
         Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus());
View Full Code Here

   public void test579() throws Exception
   {
      DefaultHttpClient client = new DefaultHttpClient();
      UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("bill", "password");
      client.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), credentials);
      ClientExecutor executor = createAuthenticatingExecutor(client);
      ClientRequest request = new ClientRequest(generateURL("/secured2"), executor);
      ClientResponse<?> response = request.get();
      Assert.assertEquals(404, response.getStatus());
      response.releaseConnection();
   }
View Full Code Here

         HttpResponse response = client.execute(method);
         Assert.assertEquals(401, response.getStatusLine().getStatusCode());
         EntityUtils.consume(response.getEntity());
      }

      ClientExecutor executor = createAuthenticatingExecutor(client);
     
      {
         UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("bill", "password");
         client.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), credentials);
         ClientRequest request = new ClientRequest(generateURL("/secured/authorized"), executor);
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.client.ClientExecutor

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.