Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpClient


      {
         if (!node0OK)
         {
            try
            {
               node0OK = (new HttpClient().executeMethod(get0) == expectedResponse);
            }
            catch (Exception ignored) {}
         }
         if (!node1OK)
         {
            try
            {
               node1OK = (new HttpClient().executeMethod(get1) == expectedResponse);
            }
            catch (Exception ignored) {}                 
         }
        
         if (node0OK && node1OK)
View Full Code Here


  
   public void doHttps(String httpsNoAuth) throws Exception
   {
      log.info("+++ testJASPIClientCert, httpsNoAuth="+httpsNoAuth);
      // Start by accessing the secured index.html of war1
      HttpClient httpConn = new HttpClient();
      String url = httpsNoAuth+"clientcert-jaspi/unrestricted/SecureServlet";
      log.info("Accessing: "+url);
      GetMethod get = new GetMethod(url);
      int responseCode = httpConn.executeMethod(get);
      String status = get.getStatusText();
      log.debug(status);
      assertTrue("Get OK("+responseCode+")", responseCode == HttpURLConnection.HTTP_OK);
   }
View Full Code Here

 
  @Before
  public void before(){
    POJOResourceFactory noDefaults = new POJOResourceFactory(resourceType);
    dispatcher.getRegistry().addResourceFactory(noDefaults);
    httpClient = new HttpClient();
    ApacheHttpClientExecutor executor = new ApacheHttpClientExecutor(httpClient);
    url = generateBaseUrl();
    client = ProxyFactory.create(BookStoreService.class, url,
          executor);
  }
View Full Code Here

  public static void beforeClass() throws Exception
  {
    dispatcher = EmbeddedContainer.start().getDispatcher();
    POJOResourceFactory noDefaults = new POJOResourceFactory(IDServiceTestBean.class);
    dispatcher.getRegistry().addResourceFactory(noDefaults);
    httpClient = new HttpClient();
    ApacheHttpClientExecutor executor = new ApacheHttpClientExecutor(httpClient);
    url = generateBaseUrl();
    client = ProxyFactory.create(IDServiceTest.class, url,
          executor);
  }
View Full Code Here

 
  @Before
  public void before(){
    POJOResourceFactory noDefaults = new POJOResourceFactory(resourceType);
    dispatcher.getRegistry().addResourceFactory(noDefaults);
    httpClient = new HttpClient();
    ApacheHttpClientExecutor executor = new ApacheHttpClientExecutor(httpClient);
    url = generateBaseUrl();
    client = ProxyFactory.create(BookStoreService.class, url,
          executor);
  }
View Full Code Here

  @Before
  public void before(){
    POJOResourceFactory noDefaults = new POJOResourceFactory(resourceType);
    dispatcher.getRegistry().addResourceFactory(noDefaults);
    httpClient = new HttpClient();
    httpClient.getState().setAuthenticationPreemptive(true);
    ApacheHttpClientExecutor executor = new ApacheHttpClientExecutor(httpClient);
    url = generateBaseUrl();
    client = ProxyFactory.create(BookStoreService.class, url,
          executor);
View Full Code Here

public class SmokeTest
{
   @Test
   public void testNoDefaultsResource() throws Exception
   {
      HttpClient client = new HttpClient();

      {
         GetMethod method = new GetMethod("http://localhost:8080/spring-integration-test/basic");
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("basic", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         PutMethod method = new PutMethod("http://localhost:8080/spring-integration-test/basic");
         method.setRequestEntity(new StringRequestEntity("basic", "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(204, status);
         method.releaseConnection();
      }
      {
         GetMethod method = new GetMethod("http://localhost:8080/spring-integration-test/queryParam");
         NameValuePair[] params = {new NameValuePair("param", "hello world")};
         method.setQueryString(params);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("hello world", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         GetMethod method = new GetMethod("http://localhost:8080/spring-integration-test/uriParam/1234");
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("1234", method.getResponseBodyAsString());
         method.releaseConnection();
      }
   }
View Full Code Here

   }

   @Test
   public void testLocatingResource() throws Exception
   {
      HttpClient client = new HttpClient();

      {
         GetMethod method = new GetMethod("http://localhost:8080/spring-integration-test/locating/basic");
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("basic", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         PutMethod method = new PutMethod("http://localhost:8080/spring-integration-test/locating/basic");
         method.setRequestEntity(new StringRequestEntity("basic", "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(204, status);
         method.releaseConnection();
      }
      {
         GetMethod method = new GetMethod("http://localhost:8080/spring-integration-test/locating/queryParam");
         NameValuePair[] params = {new NameValuePair("param", "hello world")};
         method.setQueryString(params);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("hello world", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         GetMethod method = new GetMethod("http://localhost:8080/spring-integration-test/locating/uriParam/1234");
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("1234", method.getResponseBodyAsString());
         method.releaseConnection();
      }
   }
View Full Code Here


   @Test
   public void testIt()
   {
      HttpClient client = new HttpClient();
      _test(client, "http://localhost:8080/application-config-test/my", "\"hello\"");
   }
View Full Code Here

{
   protected HttpClient httpClient;

   public ApacheHttpClientExecutor()
   {
      this.httpClient = new HttpClient();
   }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.HttpClient

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.