Package org.apache.commons.httpclient.methods

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


        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


        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_UNAUTHORIZED, post.getStatusCode());
        } finally {
            post.releaseConnection();
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

        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

    public void testPostRedirect() throws IOException {
        String host = this.server.getLocalAddress();
        int port = this.server.getLocalPort();
        this.server.setHttpService(new BasicRedirectService(host, port));
        PostMethod httppost = new PostMethod("/oldlocation/");
        httppost.setRequestEntity(new StringRequestEntity("stuff"));
        try {
            this.client.executeMethod(httppost);
            assertEquals(HttpStatus.SC_MOVED_TEMPORARILY, httppost.getStatusCode());
            assertEquals("/oldlocation/", httppost.getPath());
            assertEquals(new URI("/oldlocation/", false), httppost.getURI());
View Full Code Here

        this.client.setState(state);

        this.server.setRequestHandler(handlerchain);

        PostMethod post = new PostMethod("/test/");
        post.setRequestEntity(new StringRequestEntity("Test body"));
        try {
            this.client.executeMethod(post);
            assertEquals("Test body", post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
View Full Code Here

        this.client.setState(state);

        this.server.setRequestHandler(handlerchain);

        PutMethod put = new PutMethod("/test/");
        put.setRequestEntity(new StringRequestEntity("Test body"));
        try {
            this.client.executeMethod(put);
            assertEquals("Test body", put.getResponseBodyAsString());
        } finally {
            put.releaseConnection();
View Full Code Here

       
        this.client.getParams().setVersion(HttpVersion.HTTP_1_0);
        this.client.setHttpConnectionManager(connman);
       
        PostMethod httppost = new PostMethod("/test/");
        httppost.setRequestEntity(new StringRequestEntity("stuff"));
        try {
            this.client.executeMethod(httppost);
        } finally {
            httppost.releaseConnection();
        }
        assertFalse(connman.getConection().isOpen());

        httppost = new PostMethod("/test/");
        httppost.setRequestEntity(new StringRequestEntity("more stuff"));
        try {
            this.client.executeMethod(httppost);
        } finally {
            httppost.releaseConnection();
        }
View Full Code Here

       
        this.client.getParams().setVersion(HttpVersion.HTTP_1_1);
        this.client.setHttpConnectionManager(connman);
       
        PostMethod httppost = new PostMethod("/test/");
        httppost.setRequestEntity(new StringRequestEntity("stuff"));
        try {
            this.client.executeMethod(httppost);
        } finally {
            httppost.releaseConnection();
        }
        assertTrue(connman.getConection().isOpen());

        httppost = new PostMethod("/test/");
        httppost.setRequestEntity(new StringRequestEntity("more stuff"));
        try {
            this.client.executeMethod(httppost);
        } finally {
            httppost.releaseConnection();
        }
View Full Code Here

       
        this.client.getParams().setVersion(HttpVersion.HTTP_1_1);
        this.client.setHttpConnectionManager(connman);
       
        PostMethod httppost = new PostMethod("/test/");
        httppost.setRequestEntity(new StringRequestEntity("stuff"));
        try {
            this.client.executeMethod(httppost);
        } finally {
            httppost.releaseConnection();
        }
        assertTrue(connman.getConection().isOpen());

        httppost = new PostMethod("/test/");
        httppost.setRequestHeader("Connection", "close");
        httppost.setRequestEntity(new StringRequestEntity("more stuff"));
        try {
            this.client.executeMethod(httppost);
        } finally {
            httppost.releaseConnection();
        }
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.