Examples of DeleteMethod


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

    {
        HttpClient httpClient = new HttpClient();
        httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(userName, password));
        httpClient.getParams().setAuthenticationPreemptive(true);

        DeleteMethod deleteMethod = new DeleteMethod(uri);
        httpClient.executeMethod(deleteMethod);

        return deleteMethod;
    }
View Full Code Here

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

            } else if (method.equals(TRACE)){
                httpMethod = new TraceMethod(urlStr);
            } else if (method.equals(OPTIONS)){
                httpMethod = new OptionsMethod(urlStr);
            } else if (method.equals(DELETE)){
                httpMethod = new DeleteMethod(urlStr);
            } else if (method.equals(GET)){
                httpMethod = new GetMethod(urlStr);
            } else {
                throw new IllegalArgumentException("Unexpected method: "+method);
            }
View Full Code Here

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

    @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

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

    @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

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

                    .unregisterAnnouncement(lastInheritedAnnouncement
                            .getOwnerId());
        }

        HttpClient httpClient = new HttpClient();
        final DeleteMethod method = new DeleteMethod(uri);

        try {
            String userInfo = connectorUrl.getUserInfo();
            if (userInfo != null) {
                Credentials c = new UsernamePasswordCredentials(userInfo);
                httpClient.getState().setCredentials(
                        new AuthScope(method.getURI().getHost(), method
                                .getURI().getPort()), c);
            }

            requestValidator.trustMessage(method, null);
            httpClient.executeMethod(method);
          if (logger.isDebugEnabled()) {
              logger.debug("disconnect: done. code=" + method.getStatusCode()
                      + " - " + method.getStatusText());
          }
            // ignoring the actual statuscode though as there's little we can
            // do about it after this point
        } catch (URIException e) {
            logger.warn("disconnect: Got URIException: " + e);
        } catch (IOException e) {
            logger.warn("disconnect: got IOException: " + e);
        } catch (RuntimeException re) {
            logger.error("disconnect: got RuntimeException: " + re, re);
        } finally {
            method.releaseConnection();
        }
    }
View Full Code Here

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

    /** Delete a file from the Sling repository
     *  @return the HTTP status code
     */
    public int delete(String url) throws IOException {
        final DeleteMethod delete = new DeleteMethod(url);
        return httpClient.executeMethod(delete);
    }
View Full Code Here

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

        final PostMethod put = new PostMethod(baseUrl.toString() + "logout");
        client.executeMethod(put);

        assertThat(put.getResponseBodyAsString(), is("loggedIn"));

        final DeleteMethod delete = new DeleteMethod(baseUrl.toString() + "logout");
        client.executeMethod(delete);

        assertThat(delete.getResponseBodyAsString(), is("loggedOut and session invalidated"));
    }
View Full Code Here

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

    public Response execute(Request request) throws IOException {
        HttpMethod http = null;

        switch (request.method()) {
        case DELETE:
            http = new DeleteMethod();
            break;
        case HEAD:
            http = new HeadMethod();
            break;
        case GET:
View Full Code Here

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

    @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

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

    @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
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.