Package org.apache.commons.httpclient.methods

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


        HttpClient client = createHttpClient();
        client.getState().setCredentials(
            new AuthScope(getHost(), getPort(), "BasicAuthServlet"),
            new UsernamePasswordCredentials("jakarta","commons"));
        PutMethod method = new PutMethod("/" + getWebappContext() + "/auth/basic");
        method.setRequestEntity(new StringRequestEntity("testing one two three"));
        try {
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
            fail("Unable to execute method : " + t.toString());
View Full Code Here


        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/requestcontenttype");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "", "UTF-8"));
        try {
            client.executeMethod(postMethod);
            assertEquals(500, postMethod.getStatusCode());
            // assertLogContainsException("java.lang.IllegalArgumentException");
        } finally {
View Full Code Here

        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/unexpectedclasstype");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "text/plain",
                                                            "UTF-8"));
        try {
            client.executeMethod(postMethod);

            assertEquals(415, postMethod.getStatusCode());
View Full Code Here

        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/classtype");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "text/plain",
                                                            "UTF-8"));
        try {
            client.executeMethod(postMethod);

            assertEquals(200, postMethod.getStatusCode());
View Full Code Here

        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/nogenericentity");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "text/plain",
                                                            "UTF-8"));
        try {
            client.executeMethod(postMethod);

            assertEquals(200, postMethod.getStatusCode());
View Full Code Here

        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/genericentityempty");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "text/plain",
                                                            "UTF-8"));
        try {
            client.executeMethod(postMethod);
            assertEquals(415, postMethod.getStatusCode());
        } finally {
View Full Code Here

        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/genericentityqueuestring");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "text/plain",
                                                            "UTF-8"));
        try {
            client.executeMethod(postMethod);
            assertEquals(200, postMethod.getStatusCode());
            assertEquals("Hello thereWorld there", postMethod.getResponseBodyAsString());
View Full Code Here

        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/genericentityqueueobject");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "text/plain",
                                                            "UTF-8"));
        try {
            client.executeMethod(postMethod);
            assertEquals(415, postMethod.getStatusCode());
        } finally {
View Full Code Here

        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/notannotatedentity");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "text/plain",
                                                            "UTF-8"));
        postMethod.addRequestHeader("Accept", "text/plain");
        try {
            client.executeMethod(postMethod);
View Full Code Here

        HttpClient client = new HttpClient();

        PostMethod postMethod =
            new PostMethod(
                           getBaseURI() + "/jaxrs/tests/providers/messagebodyreader/reader/annotatedentity");
        postMethod.setRequestEntity(new StringRequestEntity("Hello\r\nWorld\r\n", "text/plain",
                                                            "UTF-8"));
        postMethod.addRequestHeader("Accept", "text/plain");
        try {
            client.executeMethod(postMethod);
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.