Package org.apache.commons.httpclient.methods

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


        PostMethod method = new PostMethod(url);
        setHeaders(method);
        method.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
        if (soapAction != null)
            method.setRequestHeader("SOAPAction", soapAction);
        method.setRequestEntity(new StringRequestEntity(body, "text/xml", "UTF-8"));
        logPostRequest(method);
        client.executeMethod(method);
        String responseStr = readInputStream(method.getResponseBodyAsStream());
        logPostResponse(method, responseStr);
        method.releaseConnection();
View Full Code Here


    }

    public void testPostSetRequestBody() throws Exception {
        PostMethod post = new PostMethod("/foo");
        String body = "this+is+the+body";
        post.setRequestEntity(new StringRequestEntity(body));
        assertEquals(body, getRequestAsString(post.getRequestEntity()));
    }
View Full Code Here

     * Tests POST via non-authenticating proxy
     */
    public void testSimplePost() throws Exception {
        this.server.setHttpService(new FeedbackService());
        PostMethod post = new PostMethod("/");
        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
View Full Code Here

        handlerchain.appendHandler(new HttpServiceHandler(new FeedbackService()));
       
        this.server.setRequestHandler(handlerchain);
       
        PostMethod post = new PostMethod("/");
        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
View Full Code Here

        handlerchain.appendHandler(new HttpServiceHandler(new FeedbackService()));
       
        this.server.setRequestHandler(handlerchain);
       
        PostMethod post = new PostMethod("/");
        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
View Full Code Here

                new UsernamePasswordCredentials("testuser", "wrongstuff"));
       
        this.server.setRequestHandler(handlerchain);
       
        PostMethod post = new PostMethod("/");
        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_UNAUTHORIZED, post.getStatusCode());
        } finally {
            post.releaseConnection();
View Full Code Here

        handlerchain.appendHandler(new HttpServiceHandler(new FeedbackService()));
       
        this.server.setRequestHandler(handlerchain);
       
        PostMethod post = new PostMethod("/");
        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
View Full Code Here

        handlerchain.appendHandler(new HttpServiceHandler(new FeedbackService()));
       
        this.server.setRequestHandler(handlerchain);
       
        PostMethod post = new PostMethod("/");
        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
View Full Code Here

        this.server.setHttpService(new FeedbackService());

        this.proxy.requireAuthentication(creds, "test", true);

        PostMethod post = new PostMethod("/");
        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
View Full Code Here

        this.server.setRequestHandler(handlerchain);
       
        this.proxy.requireAuthentication(creds, "test", true);

        PostMethod post = new PostMethod("/");
        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.methods.StringRequestEntity

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.