Package org.apache.commons.httpclient.methods

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


   * @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();
    int code = execute(cluster, method, null, path);
    Header[] headers = method.getResponseHeaders();
    method.releaseConnection();
    return new Response(code, headers);
  }
View Full Code Here


        this.apiUrl = apiUrl;
        this.username = username;
        this.password = password;
        client = new HttpClient(s_httpclient_params, s_httpclient_manager);
        postMethod = new PostMethod(apiUrl);
        deleteMethod = new DeleteMethod(apiUrl);
        putMethod = new PutMethod(apiUrl);
    }
View Full Code Here

        }
        return null;
    }

    public boolean deleteTenantNetwork(String tenantNetworkUuid){
        DeleteMethod method = deleteMethod;
        method.setPath("/ssp.v1/tenant-networks/"+tenantNetworkUuid);

        executeMethod(method);
        if(method.getStatusCode() == HttpStatus.SC_NO_CONTENT){
            return true;
        }
        return false;
    }
View Full Code Here

        }
        return null;
    }

    public boolean deleteTenantPort(String tenantPortUuid){
        DeleteMethod method = deleteMethod;
        method.setPath("/ssp.v1/tenant-ports/"+tenantPortUuid);

        executeMethod(method);
        if(method.getStatusCode() == HttpStatus.SC_NO_CONTENT){
            return true;
        }
        return false;
    }
View Full Code Here

        }
        else if ("get".equalsIgnoreCase(type)) {
          return new GetMethod(url);
        }
        else if ("delete".equalsIgnoreCase(type)) {
          return new DeleteMethod(url);
        }
        else if ("put".equalsIgnoreCase(type)) {
          return new PutMethod(url);
        }
        else {
View Full Code Here

            _adminuser == null || _adminuser.isEmpty() ||
            _adminpass == null || _adminpass.isEmpty()) {
          throw new NiciraNvpApiException("Hostname/credentials are null or empty");
        }
          
        DeleteMethod dm = (DeleteMethod) createMethod("delete", uri);
        dm.setRequestHeader("Content-Type", "application/json");
               
        executeMethod(dm);
       
        if (dm.getStatusCode() != HttpStatus.SC_NO_CONTENT) {
            String errorMessage = responseToErrorMessage(dm);
            dm.releaseConnection();
            s_logger.error("Failed to delete object : " + errorMessage);
            throw new NiciraNvpApiException("Failed to delete object : " + errorMessage);
        }
        dm.releaseConnection();
    }
View Full Code Here

        }
        else if ("get".equalsIgnoreCase(type)) {
            return new GetMethod(url);
        }
        else if ("delete".equalsIgnoreCase(type)) {
            return new DeleteMethod(url);
        }
        else if ("put".equalsIgnoreCase(type)) {
            return new PutMethod(url);
        }
        else {
View Full Code Here

    protected void executeDeleteObject(String uri) throws BigSwitchVnsApiException {
        if (_host == null || _host.isEmpty()) {
            throw new BigSwitchVnsApiException("Hostname is null or empty");
        }

        DeleteMethod dm = (DeleteMethod) createMethod("delete", uri, 80);
        dm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
        dm.setRequestHeader(ACCEPT, CONTENT_JSON);
        dm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);

        executeMethod(dm);

        if (dm.getStatusCode() != HttpStatus.SC_OK) {
            String errorMessage = responseToErrorMessage(dm);
            dm.releaseConnection();
            s_logger.error("Failed to delete object : " + errorMessage);
            throw new BigSwitchVnsApiException("Failed to delete object : " + errorMessage);
        }
        dm.releaseConnection();
    }
View Full Code Here

        //  etc...
        if ("GET".equalsIgnoreCase(verb) || "DELETE".equalsIgnoreCase(verb)) {
            if ("GET".equalsIgnoreCase(verb)) {
                method = new GetMethod();
            } else if ("DELETE".equalsIgnoreCase(verb)) {
                method = new DeleteMethod();
            }
            if (useUrlEncoded) {
                queryPath = encodedParams;
            }
View Full Code Here

  public void deleteParticipant() throws HttpException, IOException {
    //
    // Delete the participant
    //
    HttpClient client = new HttpClient();
    DeleteMethod post = new DeleteMethod(TEST_PARTICIPANTS_SERVICE_URL_VALID);
    post.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
        + WIDGET_ID_VALID
        + "&userid=test&shareddatakey=participantstest&participant_id=1");
    client.executeMethod(post);
    int code = post.getStatusCode();
    assertEquals(200, code);
    post.releaseConnection();

    //
    // Now lets GET it to make sure it was deleted
    //
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.