Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpClient


      getLog().debug("Enter testNonPrimitiveModifyFromAlternativeNode");

      getLog().debug(setUrl + ":::::::" + getUrl);

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();

      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);

      // Get the Attribute set
View Full Code Here


   {
      String attr = "";
      getLog().debug("Enter testSessionBindingEvent");

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();
     
      // Bind a new HttpSessionListener to the session
      // and check that there is a valueBound() event
      attr = makeGet(client, baseURL0_ + bindUrl_ + "new");
      assertTrue("Got OK when binding a new listener",
View Full Code Here

      getLog().debug("Enter testExcludeSecuritySubject");
  
      getLog().debug(setSecuritySubjectUrl_ + ":::::::" + getSecuritySubjectUrl_);
  
      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();
  
      // Set the session attribute first
      makeGet(client, baseURL0_ +setSecuritySubjectUrl_);
  
      // Confirm the attribute is available from the server where it was set
View Full Code Here

      getLog().debug("Enter testIsNew");

      getLog().debug(setUrl + ":::::::" + getUrl);

      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();

      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);
     
      sleepThread(DEFAULT_SLEEP);
View Full Code Here

   }

   protected void invalidate() throws Exception
   {
      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();

      // Set the session attribute first
      makeGet(client, baseURL0_ +setUrl);

      // Get the Attribute set
View Full Code Here

   }

   protected void clear() throws Exception
   {
      // Create an instance of HttpClient.
      HttpClient client = new HttpClient();

      // Set the session attribute first
      makeGet(client, baseURL0_ +clearUrl);
   }
View Full Code Here

   public void badtestFormAuthFailover() throws Exception
   {
      log.info("+++ testFormAuthFailover");
     
      // Start by accessing the war's protected url
      HttpClient client = new HttpClient();
     
      String body = makeGet(client, baseURL0_ + protectedUrl_);
      if( body.indexOf("j_security_check") < 0 )
         fail("get of "+protectedUrl_+" not redirected to login page");
     
      HttpState state = client.getState();
      Cookie[] cookies = state.getCookies();
      String sessionID = null;
      for(int c = 0; c < cookies.length; c ++)
      {
         Cookie k = cookies[c];
         if( k.getName().equalsIgnoreCase("JSESSIONID") )
            sessionID = k.getValue();
      }
      log.debug("Saw JSESSIONID="+sessionID);

      // Submit the login form
      PostMethod formPost = new PostMethod(baseURL0_ + securityCheckUrl_);
      formPost.addRequestHeader("Referer", baseURL0_ + loginFormUrl_);
      formPost.addParameter("j_username", "admin");
      formPost.addParameter("j_password", "admin");
      int responseCode = client.executeMethod(formPost.getHostConfiguration(),
         formPost, state);
      String response = formPost.getStatusText();
      log.debug("responseCode="+responseCode+", response="+response);
      assertTrue("Saw HTTP_MOVED_TEMP("+responseCode+")",
         responseCode == HttpURLConnection.HTTP_MOVED_TEMP);
View Full Code Here

   {
      String warA1 = serverA + "/war1/";
      String warB2 = serverB + "/war2/";
     
      // Start by accessing the secured index.html of war1
      HttpClient httpConn = new HttpClient();
     
      checkAccessDenied(httpConn, warA1 + "index.html");

      HttpState state = httpConn.getState();
     
      log.debug("Saw JSESSIONID="+getSessionIdValueFromState(state));

      // Submit the login form
      executeFormLogin(httpConn, warA1);
View Full Code Here

      String warA1 = serverA + "/war1/";
      String warB2 = serverB + "/war2/";
      String warB6 = serverB + "/war6/";
     
      // Start by accessing the secured index.html of war1
      HttpClient httpConn = new HttpClient();

      checkAccessDenied(httpConn, warA1 + "index.html");

      HttpState state = httpConn.getState();

      log.debug("Saw JSESSIONID="+getSessionIdValueFromState(state));

      // Submit the login form
      executeFormLogin(httpConn, warA1);
View Full Code Here

      super(name);
   }

   public void testStatusServlet() throws Exception
   {
      HttpClient httpConn = new HttpClient();
      String url = "http://" + getServerHost() + ":" + Integer.getInteger("web.port", 8080) + "/status?full=true";
      GetMethod getMethod = new GetMethod(url);
      int responseCode = httpConn.executeMethod(getMethod);
      assertEquals("GET " + url + " OK", HttpURLConnection.HTTP_OK, responseCode);
   }
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.