Examples of executeMethod()


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

          Header locationHeader = hMethod
              .getResponseHeader("location");
          if (locationHeader != null) {
            redirectLocation = locationHeader.getValue();
            hMethod = new HeadMethod(redirectLocation);
            status = hClient.executeMethod(hMethod);
            if (status != HttpStatus.SC_OK) {
              throw new NetworkException(hMethod.getStatusLine()
                  .getReasonPhrase());
            }
          } else {
View Full Code Here

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

            } catch (Exception e) {
              throw new NetworkException(e.getMessage());
            }
            hMethod = new HeadMethod(url.toString());
            hMethod.setDoAuthentication(true);
            status = hClient.executeMethod(hMethod);
            if (status != HttpStatus.SC_OK) {
              throw new NetworkException(hMethod.getStatusLine()
                  .getReasonPhrase());
            }
          } else {
View Full Code Here

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

        // we break in case of error.

        boolean lContinue = true;
        while (lContinue) {

          int status = hClient.executeMethod(gMethod);
          switch (status) { // Switch the result.
          case HttpStatus.SC_OK: {
            lContinue = false;
          }
            break;
View Full Code Here

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

      setupProxy(proxySettings, client, url);

      method = new GetMethod(url.toString());
      method.setFollowRedirects(true);

      resultCode = client.executeMethod(method);
      if (s_log.isDebugEnabled())
      {
        s_log.debug("downloadHttpFile: response code was: " + resultCode);
      }
View Full Code Here

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

      HttpClient client = new HttpClient();
      GetMethod method = new GetMethod(url);
      int responseCode = 0;
      try
      {
         responseCode = client.executeMethod(method);
        
         assertTrue("Get OK with url: " +url + " responseCode: " +responseCode
               , responseCode == HttpURLConnection.HTTP_OK);
        
         InputStream rs = method.getResponseBodyAsStream();
View Full Code Here

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

   private String accessURL(String url) throws Exception
   {
      HttpClient httpConn = new HttpClient();
      HttpMethodBase request = new GetMethod(baseURL + url);
      log.debug("RequestURI: " + request.getURI());
      int responseCode = httpConn.executeMethod(request);
      String response = request.getStatusText();
      log.debug("responseCode="+responseCode+", response="+response);
      String content = request.getResponseBodyAsString();
      log.debug(content);
      assertEquals(HttpURLConnection.HTTP_OK, responseCode);
View Full Code Here

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

         {
            UsernamePasswordCredentials auth = new UsernamePasswordCredentials(userInfo);
            httpConn.getState().setCredentials(realm, url.getHost(), auth);
         }
         log.debug("RequestURI: "+request.getURI());
         int responseCode = httpConn.executeMethod(request);
         String response = request.getStatusText();
         log.debug("responseCode="+responseCode+", response="+response);
         String content = request.getResponseBodyAsString();
         log.debug(content);
         // Validate that we are seeing the requested response code
View Full Code Here

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

   public String accessURL(String url) throws Exception
   {
      HttpClient httpConn = new HttpClient();
      HttpMethodBase request = new GetMethod(baseURL + url);
      log.debug("RequestURI: " + request.getURI());
      int responseCode = httpConn.executeMethod(request);
      String response = request.getStatusText();
      log.debug("responseCode="+responseCode+", response="+response);
      String content = request.getResponseBodyAsString();
      log.debug(content);
      assertEquals(HttpURLConnection.HTTP_OK, responseCode);
View Full Code Here

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

      get1.addRequestHeader("Accept", "text/plain");
      GetMethod get2 = new GetMethod(BASE_URI + getTestPrefix());
      get2.addRequestHeader("Accept", "text/plain");
      try
      {
         int status1 = client.executeMethod(get1);
         assertEquals(status1, 200);
         String response1 = get1.getResponseBodyAsString();
         get1.releaseConnection();
         int status2 = client.executeMethod(get2);
         assertEquals(status2, 200);
View Full Code Here

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

      {
         int status1 = client.executeMethod(get1);
         assertEquals(status1, 200);
         String response1 = get1.getResponseBodyAsString();
         get1.releaseConnection();
         int status2 = client.executeMethod(get2);
         assertEquals(status2, 200);
         String response2 = get2.getResponseBodyAsString();
         get2.releaseConnection();
         assertEquals(response1, response2);
      }
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.