Package org.apache.http.client.methods

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


        String r = configClient.replacePath("/setAllowCredentials/false")
            .accept("text/plain").post(null, String.class);
        assertEquals("ok", r);
       
        HttpClient httpclient = new DefaultHttpClient();
        HttpDelete httpdelete = new HttpDelete("http://localhost:" + PORT + "/untest/delete");
        httpdelete.addHeader("Origin", "http://localhost:" + PORT);

        HttpResponse response = httpclient.execute(httpdelete);
        assertEquals(200, response.getStatusLine().getStatusCode());
        assertAllowCredentials(response, false);
        assertOriginResponse(true, null, true, response);
View Full Code Here


        public Message invoke(Message msg) {
            // Delete an entry
            String id = (String)((Object[])msg.getBody())[0];

            // Send an HTTP DELETE
            HttpDelete deleteMethod = new HttpDelete(uri + "/" + id);
            if (authorizationHeader != null) {
                deleteMethod.setHeader("Authorization", authorizationHeader);
            }
            HttpResponse response = null;
            try {
                response = httpClient.execute(deleteMethod);
                int status = response.getStatusLine().getStatusCode();
View Full Code Here

            fullUrl += "clientUUID=" + _clientId;
        }

        fullUrl += "&profileIdentifier=" + uriEncode(this._profileName);

        HttpDelete get = new HttpDelete(fullUrl);

        HttpClient client = new DefaultHttpClient();
        HttpConnectionParams.setConnectionTimeout(client.getParams(), _timeout);
        HttpConnectionParams.setSoTimeout(client.getParams(), _timeout);
View Full Code Here

    return true;
  }

  @Override
  public ApacheHttpRequest buildDeleteRequest(String url) {
    return new ApacheHttpRequest(httpClient, new HttpDelete(url));
  }
View Full Code Here

      }
   }

   @Override
   public void clear() {
      HttpDelete del = new HttpDelete(path);
      try {
         HttpResponse response = httpClient.execute(httpHost, del);
         EntityUtils.consume(response.getEntity());
      } catch (Exception e) {
         throw new PersistenceException(e);
      } finally {
         del.abort();
      }
   }
View Full Code Here

      }
   }

   @Override
   public boolean delete(Object key) {
      HttpDelete del = new HttpDelete(keyToUri(key));
      try {
         HttpResponse response = httpClient.execute(httpHost, del);
         EntityUtils.consume(response.getEntity());
         return isSuccessful(response.getStatusLine().getStatusCode());
      } catch (Exception e) {
         throw new PersistenceException(e);
      } finally {
         del.abort();
      }
   }
View Full Code Here

    assertTrue(payload.contains("error"));
  }

  @Test
  public void delete() throws Exception {
    final HttpDelete delete = new HttpDelete(URI.create(getEndpoint().toString() + "aaa/bbb/ccc"));
    final HttpResponse response = getHttpClient().execute(delete);

    assertEquals(HttpStatusCodes.NOT_FOUND.getStatusCode(), response.getStatusLine().getStatusCode());
    final String payload = StringHelper.inputStreamToString(response.getEntity().getContent());
    assertTrue(payload.contains("error"));
View Full Code Here

      final String requestBody, final String requestContentType,
      final HttpStatusCodes expectedStatusCode) throws Exception {

    HttpRequestBase request =
        httpMethod == ODataHttpMethod.GET ? new HttpGet() :
            httpMethod == ODataHttpMethod.DELETE ? new HttpDelete() :
                httpMethod == ODataHttpMethod.POST ? new HttpPost() :
                    httpMethod == ODataHttpMethod.PUT ? new HttpPut() : new HttpPatch();
    request.setURI(URI.create(getEndpoint() + uri));
    if (additionalHeader != null) {
      request.addHeader(additionalHeader, additionalHeaderValue);
View Full Code Here

      } else if ("GET".equals(methodType)) {
        httpMethod = new HttpGet(requestUri);
      } else if ("HEAD".equals(methodType)) {
        httpMethod = new HttpHead(requestUri);
      } else if ("DELETE".equals(methodType)) {
        httpMethod = new HttpDelete(requestUri);
      }
      for (Map.Entry<String, List<String>> entry : request.getHeaders().entrySet()) {
        httpMethod.addHeader(entry.getKey(), Joiner.on(',').join(entry.getValue()));
      }
View Full Code Here

      response = execRequest(httpPost, args, content);
    } else if (StringUtil.equalsIgnoreCase(method, METHOD_PUT)) {
      HttpPut httpPut = new HttpPut(url);
      response = execRequest(httpPut, args, content);
    } else if (StringUtil.equalsIgnoreCase(method, METHOD_DELETE)) {
      HttpDelete httpDelete = new HttpDelete(url);
      response = execRequest(httpDelete, args, content);
    } else if (StringUtil.equalsIgnoreCase(method,METHOD_DELETE_BODY)){
      HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(url);
      response = execRequest(httpDelete, args, content);
    } else {
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.