Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.DeleteMethod


    @Test
    public void testDeleteBookByQuery() throws Exception {
        String endpointAddress =
            "http://localhost:9080/bookstore/books/id?value=123";

        DeleteMethod post = new DeleteMethod(endpointAddress);
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
            assertEquals(200, result);
        } finally {
            // Release current connection to the connection pool once you are done
            post.releaseConnection();
       
    }
View Full Code Here


        return res;
    }
   
    protected static HttpResponse delete(String url, String user, String password) throws IOException {
        HttpClient httpClient = new HttpClient();
        HttpMethod method = new DeleteMethod(url);
        addAuthHeader(method, user, password);
       
        String contentType = "application/xml; charset=utf-8";
        method.setRequestHeader("Content-type", contentType);
       
        int status = httpClient.executeMethod(method);
        InputStream responseBody = method.getResponseBodyAsStream();
       
        HttpResponse res = new HttpResponse(status, responseBody);
        return res;
    }
View Full Code Here

            if (request.getContent() != null) {
                putMethod.setRequestEntity(new RepeatableInputStreamRequestEntity(request));
            }
        } else if (request.getMethodName() == HttpMethodName.DELETE) {
            DeleteMethod deleteMethod = new DeleteMethod(uri);
            if (nameValuePairs != null) deleteMethod.setQueryString(nameValuePairs);
            method = deleteMethod;
        } else if (request.getMethodName() == HttpMethodName.HEAD) {
            HeadMethod headMethod = new HeadMethod(uri);
            if (nameValuePairs != null) headMethod.setQueryString(nameValuePairs);
            method = headMethod;
View Full Code Here

        History history = new History();
        logOriginalRequestHistory("DELETE", request, history);
        requestInfo.originalRequestInfo = new HttpRequestInfo(request);

        try {
            DeleteMethod getMethodProxyRequest = new DeleteMethod(getProxyURL(
                    request, history, Constants.REQUEST_TYPE_DELETE));
            // set headers
            setProxyRequestHeaders(request, getMethodProxyRequest);
            // execute request
            executeProxyRequest(getMethodProxyRequest, request, response, history);
View Full Code Here

    @Test
    public void testDeleteBook() throws Exception {
        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/books/123";

        DeleteMethod post = new DeleteMethod(endpointAddress);
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
            assertEquals(200, result);
        } finally {
            // Release current connection to the connection pool once you are done
            post.releaseConnection();
       
    }
View Full Code Here

    @Test
    public void testDeleteBookByQuery() throws Exception {
        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/books/id?value=123";

        DeleteMethod post = new DeleteMethod(endpointAddress);
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
            assertEquals(200, result);
        } finally {
            // Release current connection to the connection pool once you are done
            post.releaseConnection();
       
    }
View Full Code Here

   * @param path the path or URI
   * @return a Response object with response detail
   * @throws IOException
   */
  public Response delete(Cluster cluster, String path) throws IOException {
    DeleteMethod method = new DeleteMethod();
    try {
      int code = execute(cluster, method, null, path);
      Header[] headers = method.getResponseHeaders();
      byte[] content = method.getResponseBody();
      return new Response(code, headers, content);
    } finally {
      method.releaseConnection();
    }
  }
View Full Code Here

    @Test
    public void testDeleteBook() throws Exception {
        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/books/123";

        DeleteMethod post = new DeleteMethod(endpointAddress);
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
            assertEquals(200, result);
        } finally {
            // Release current connection to the connection pool once you are done
            post.releaseConnection();
       
    }
View Full Code Here

    @Test
    public void testDeleteBookByQuery() throws Exception {
        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/books/id?value=123";

        DeleteMethod post = new DeleteMethod(endpointAddress);
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
            assertEquals(200, result);
        } finally {
            // Release current connection to the connection pool once you are done
            post.releaseConnection();
       
    }
View Full Code Here

 
  @AfterClass
  public static void tearDown() throws HttpException, IOException{
    HttpClient client = new HttpClient();
    setAuthenticationCredentials(client);
    DeleteMethod delete = new DeleteMethod(TEST_WIDGETS_SERVICE_URL_VALID + "/" + WIDGET_ID_LOCALIZED);
    client.executeMethod(delete);
    delete.releaseConnection();
 
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.methods.DeleteMethod

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.