Examples of executeMethod()


Examples of org.apache.commons.httpclient.HttpClient.executeMethod()

      // Start by accessing the secured index.html of war1
      HttpClient httpConn = new HttpClient();
     
      // Try to access protected resource
      GetMethod indexGet = new GetMethod(url + "index.jsp");
      int responseCode = httpConn.executeMethod(indexGet);
      String body = indexGet.getResponseBodyAsString();
      assertTrue("Get OK", responseCode == HttpURLConnection.HTTP_OK);
      assertTrue("Redirected to login page", body.indexOf("j_security_check") > 0 );

      // Submit the login form
View Full Code Here

Examples of org.apache.commons.httpclient.HttpClient.executeMethod()

   
      PostMethod formPost = new PostMethod(url + "j_security_check");
      formPost.addRequestHeader("Referer", url + "login.html");
      formPost.addParameter("j_username", "admin");
      formPost.addParameter("j_password", "admin");
      responseCode = httpConn.executeMethod(formPost.getHostConfiguration(),
         formPost, httpConn.getState());
      assertTrue("Saw HTTP_MOVED_TEMP("+responseCode+")",
         responseCode == HttpURLConnection.HTTP_MOVED_TEMP);

      //  Follow the redirect to the index.html page
View Full Code Here

Examples of org.apache.commons.httpclient.HttpClient.executeMethod()

      //  Follow the redirect to the index.html page
      Header location = formPost.getResponseHeader("Location");
      String indexURI = location.getValue();
      GetMethod warIndex = new GetMethod(indexURI);
      responseCode = httpConn.executeMethod(warIndex.getHostConfiguration(),
         warIndex, httpConn.getState());
      assertTrue("Get OK", responseCode == HttpURLConnection.HTTP_OK);
      body = warIndex.getResponseBodyAsString();
      if( body.indexOf("j_security_check") > 0 )
         fail("get of "+indexURI+" redirected to login page");
View Full Code Here

Examples of org.apache.commons.httpclient.HttpClient.executeMethod()

      // Start by accessing the secured index.html of war1
      HttpClient httpConn = new HttpClient();
      String url = httpNoAuth+"clientcert-auth/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);
   }
   public void doHttps(String httpsNoAuth) throws Exception
View Full Code Here

Examples of org.directwebremoting.extend.Module.executeMethod()

                buffer.append(call.getCallId());

                Loggers.ACCESS.info(buffer.toString());
            }

            Object reply = module.executeMethod(method, call.getParameters());

            return new Reply(call.getCallId(), reply);
        }
        catch (SecurityException ex)
        {
View Full Code Here

Examples of our.apache.commons.httpclient.HttpClient.executeMethod()

        int statusCode = -1;
        int attempt = 0;

        // Retry the request up to 3 times
        while ((statusCode == -1) && (attempt < 3)) {
            statusCode = client.executeMethod(method);
            attempt++;
        }

        // If the status code is still -1 then ran out of retries to
        // connect to the server
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.