Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpDelete


    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpDelete httpdelete = new HttpDelete("http://localhost:" + PORT + "/delete");
    HttpResponse response = httpclient.execute(httpdelete);

    assertNotNull(response);
    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here


      {
         return new HttpPost(url);
      }
      else if ("DELETE".equals(restVerb))
      {
         return new HttpDelete(url);
      }
      else
      {
         final String verb = restVerb;
         return new HttpPost(url)
View Full Code Here

            } else if (method.equals(TRACE)) {
                httpRequest = new HttpTrace(uri);
            } else if (method.equals(OPTIONS)) {
                httpRequest = new HttpOptions(uri);
            } else if (method.equals(DELETE)) {
                httpRequest = new HttpDelete(uri);
            } else if (method.equals(GET)) {
                httpRequest = new HttpGet(uri);
            } else {
                throw new IllegalArgumentException("Unexpected method: "+method);
            }
View Full Code Here

   
    /** Delete supplied path */
    public void delete(String path) throws IOException {
        executor.execute(
        builder.buildOtherRequest(
            new HttpDelete(builder.buildUrl(path)))
            .withCredentials(username, password)
        )
        .assertStatus(204);
    }
View Full Code Here

    return deleteJSON(url, connectionTimeout, soTimeout);
  }
 
  private static Map<String, Object> deleteJSON(String url, Integer connectionTimeout, Integer soTimeout)
  {
    return executeMethod(new HttpDelete(url), url, null, connectionTimeout, soTimeout);
  }
View Full Code Here

    return deleteJSON(url, connectionTimeout, soTimeout);
  }
 
  private static Map<String, Object> deleteJSON(String url, Integer connectionTimeout, Integer soTimeout)
  {
    return executeMethod(new HttpDelete(url), url, null, connectionTimeout, soTimeout);
  }
View Full Code Here

    return executeMethod(new HttpGet(url), url, null, connectionTimeout, soTimeout);
  }

  public static Map<String, Object> delete(String url, Integer connectionTimeout, Integer soTimeout)
  {
    return executeMethod(new HttpDelete(url), url, null, connectionTimeout, soTimeout);
  }
View Full Code Here

    }

    @Override
    public void delete(String resourcePath, final Olingo2ResponseHandler<HttpStatusCodes> responseHandler) {

        execute(new HttpDelete(createUri(resourcePath)), contentType,
            new AbstractFutureCallback<HttpStatusCodes>(responseHandler) {
                @Override
                public void onCompleted(HttpResponse result) {
                    final StatusLine statusLine = result.getStatusLine();
                    responseHandler.onResponse(HttpStatusCodes.fromStatusCode(statusLine.getStatusCode()));
View Full Code Here

            HttpResponse response = httpclient.execute(post);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
                         EntityUtils.toString(response.getEntity()));
           
            HttpDelete del = new HttpDelete("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers/124/");
            response = httpclient.execute(del);
            // need to check the response of delete method
            assertEquals(200, response.getStatusLine().getStatusCode());
        } finally {
            httpclient.close();
View Full Code Here

            HttpResponse response = httpclient.execute(post);
            assertEquals(201, response.getStatusLine().getStatusCode());
            assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
                         EntityUtils.toString(response.getEntity()));

            HttpDelete del = new HttpDelete("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers/124/");
            response = httpclient.execute(del);
            // need to check the response of delete method
            assertEquals(200, response.getStatusLine().getStatusCode());
        } finally {
            httpclient.close();
View Full Code Here

TOP

Related Classes of org.apache.http.client.methods.HttpDelete

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.