Examples of releaseConnection()


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

         location = postMethod.getResponseHeader("Location");
         assertNotNull("Location header not found in response", location);
      }
      finally
      {
         postMethod.releaseConnection();
      }

      // follow the redirect as defined by the location header
      String indexURI = location.getValue();
      getMethod = new GetMethod(indexURI);
View Full Code Here

Examples of org.apache.commons.httpclient.methods.PutMethod.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);
View Full Code Here

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

         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);
View Full Code Here

Examples of org.apache.commons.httpclient.methods.PutMethod.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();
      }
   }

   @Test
   public void testLocatingResource() throws Exception
View Full Code Here

Examples of org.apache.commons.httpclient.methods.PutMethod.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);
View Full Code Here

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

        TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOff + "/myservice");
        httpclient.executeMethod(trace);

        // TRACE shouldn't be allowed by default
        assertTrue(trace.getStatusCode() == 405);
        trace.releaseConnection();
    }
   
    @Test
    public void testTraceEnabled() throws Exception {       
        HttpClient httpclient = new HttpClient();
View Full Code Here

Examples of org.apache.http.HttpResponse.releaseConnection()

         UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("mo", "password");
         client.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), credentials);
         ClientRequest request = new ClientRequest(generateURL("/secured/authorized"), executor);
         ClientResponse<?> response = request.get();
         Assert.assertEquals(HttpResponseCodes.SC_FORBIDDEN, response.getStatus());
         response.releaseConnection();
      }
   }

   /**
    * Create a ClientExecutor which does preemptive authentication.
View Full Code Here

Examples of org.apache.http.client.methods.HttpDelete.releaseConnection()

                    log.error("error deleting configuration {}: {} {}",new Object[] {key,response.getStatusLine().getStatusCode(),response.getStatusLine().getReasonPhrase()});
                    throw new MarmottaClientException("error deleting configuration "+key+": "+response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase());
            }

        } finally {
            delete.releaseConnection();
        }
    }

}
View Full Code Here

Examples of org.apache.http.client.methods.HttpEntityEnclosingRequestBase.releaseConnection()

            }
        } catch (IOException e) {
            method.abort();
            throw e;
        } finally {
            method.releaseConnection();
        }

        try {
            Header redirectUrl = response.getFirstHeader("Location");
            if (redirectUrl == null) {
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet.releaseConnection()

      return IoUtils.readAll(is);
    } catch (IOException e) {
      throw new JenkinsException("Error making request to Jenkins", e);
    } finally {
      IoUtils.safeClose(is);
      method.releaseConnection();
    }
  }

  Document parse(String xml) throws JenkinsException {
    try {
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.