Examples of HttpDelete


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

        httpPatch.setEntity(new StringEntity(body));
        return httpPatch;
      }

      if (requestMethod.equals("DELETE")) {
        HttpDelete httpDelete = new HttpDelete(uri);
        httpDelete.setHeader("Accept", acceptType);
        return httpDelete;
      }

      if (requestMethod.equals("PUT")) {
        HttpPut httpPut = new HttpPut(uri);
View Full Code Here

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

    case PUT:
      request = new HttpPut(uri);
      break;

    case DELETE:
      request = new HttpDelete(uri);
      break;

    default:
      throw new IllegalArgumentException("Unhandled method: " + method);
    }
View Full Code Here

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

            break;
          case POST:
            meth = new HttpPost(url);
            break;
          case DELETE:
            meth = new HttpDelete(url);
            break;
          case PUT:
            meth = new HttpPut(url);
            break;
          default:
View Full Code Here

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

            switch (method) {
                case GET:
                    httpMethod = new HttpGet(url);
                    break;
                case DELETE:
                    httpMethod = new HttpDelete(url);
                    break;

                case POST:
                    httpMethod = new HttpPost(url);
                    ((HttpPost) httpMethod).setEntity(new StringEntity(this.requestBody));
View Full Code Here

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

            }
        }
    }

    private void doAuthenticatedDelete(String url) throws Exception {
        HttpDelete request = new HttpDelete(url + "?oauth_token=" + oauthToken);
        HttpResponse response = null;
        try {
            // set the content type to json
            request.setHeader("Content-Type", "application/json; charset=utf-8");
            // send the request
            response = httpClient.execute(request);
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode == 401) {
                throw new RuntimeException("unable to execute DELETE - url: " + url);
View Full Code Here

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

  */
  public String performAPIDeleteOperation(String apiURL, int expectedResponse)
    throws Exception
  {
    DefaultHttpClient client = new DefaultHttpClient();
    HttpDelete method = new HttpDelete(apiURL);
    try
    {
      HttpResponse response = client.execute(method);
      int responseCode = response.getStatusLine().getStatusCode();
      String responseString = convertToString(response);
      if (responseCode != expectedResponse)
        throw new Exception("API http error; expected "+Integer.toString(expectedResponse)+", saw "+Integer.toString(responseCode)+": "+responseString);
      // We presume that the data is utf-8, since that's what the API uses throughout.
      return responseString;
    }
    finally
    {
      method.abort();
    }
  }
View Full Code Here

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

        super(URI.create(requestURI));
    }

    @Override
    protected HttpUriRequest createRequest(final URI requestURI) {
        return new HttpDelete(requestURI);
    }
View Full Code Here

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

    public static HttpAsyncRequestProducer createHead(final String requestURI) {
        return create(new HttpGet(URI.create(requestURI)));
    }

    public static HttpAsyncRequestProducer createDelete(final URI requestURI) {
        return create(new HttpDelete(requestURI));
    }
View Full Code Here

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

    public static HttpAsyncRequestProducer createDelete(final URI requestURI) {
        return create(new HttpDelete(requestURI));
    }

    public static HttpAsyncRequestProducer createDelete(final String requestURI) {
        return create(new HttpDelete(URI.create(requestURI)));
    }
View Full Code Here

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

        Assert.assertEquals(405, response.getStatusLine().getStatusCode());
    }

    @Test
    public void doNotAllowDelete() throws Exception {
        HttpResponse response = httpclient.execute(new HttpDelete(getServerUrl()));

        Assert.assertEquals(405, response.getStatusLine().getStatusCode());
    }
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.