Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.GetMethod.releaseConnection()


          if (200 != status) {
              throw new RuntimeException("Unexpected status");
          }
          return method.getResponseBodyAsString();
      } finally {
          method.releaseConnection();
      }
   }
 
  public void tryAccessEndUserAdminResource(Token accessToken) throws Exception
    {
View Full Code Here


            int status = client.executeMethod(method);
            if (401 != status) {
                throw new RuntimeException("Unexpected status");
            }
        } finally {
            method.releaseConnection();
        }
   } 

   private String getRequestURL(String consumerKey, String consumerSecret,
                                String callbackURI, String scope, String permission) throws Exception {
View Full Code Here

         GetMethod method = createGetMethod("/secured");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("hello", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         GetMethod method = createGetMethod("/secured/authorized");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
View Full Code Here

         GetMethod method = createGetMethod("/secured/authorized");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("authorized", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         GetMethod method = createGetMethod("/secured/deny");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
View Full Code Here

      {
         GetMethod method = createGetMethod("/secured/deny");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_UNAUTHORIZED, status);
         method.releaseConnection();
      }
      client.getHttpConnectionManager().closeIdleConnections(0);

   }
View Full Code Here

      {
         GetMethod method = createGetMethod("/secured");
         int status = client.executeMethod(method);
         Assert.assertEquals(401, status);
         method.releaseConnection();
      }

      client.getParams().setAuthenticationPreemptive(true);

      client.getState().setCredentials(
View Full Code Here

      {
         GetMethod method = createGetMethod("/secured/authorized");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_UNAUTHORIZED, status);
         method.releaseConnection();
      }
      client.getHttpConnectionManager().closeIdleConnections(0);
   }
}
View Full Code Here

      Assert.assertEquals(200, status);
      String string = get.getResponseBodyAsString();
      System.out.println(string);
      Assert.assertTrue(string.indexOf("Content-Length") > -1);

      get.releaseConnection();
   }

}
View Full Code Here

    HttpClient httpClient = new HttpClient();

    GetMethod jettyMethod = new GetMethod("http://localhost:" + jettyPort + path);
    int jettyStatusCode = httpClient.executeMethod(jettyMethod);
    String jettyResponse = jettyMethod.getResponseBodyAsString().trim();
    jettyMethod.releaseConnection();


    GetMethod xSocketMethod = new GetMethod("http://localhost:" + xSocketPort + path);
    int xSocketStatusCode = httpClient.executeMethod(xSocketMethod);
    String xSocketResponse = xSocketMethod.getResponseBodyAsString().trim();
View Full Code Here


    GetMethod xSocketMethod = new GetMethod("http://localhost:" + xSocketPort + path);
    int xSocketStatusCode = httpClient.executeMethod(xSocketMethod);
    String xSocketResponse = xSocketMethod.getResponseBodyAsString().trim();
    xSocketMethod.releaseConnection();

    Assert.assertEquals(jettyStatusCode, xSocketStatusCode);
    Assert.assertEquals(jettyResponse, xSocketResponse);
  }
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.