Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.PostMethod.addRequestHeader()


        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/booksplain";

        PostMethod post = new PostMethod(endpointAddress);
        post.addRequestHeader("Content-Type" , "text/plain");
        post.addRequestHeader("Accept" , "text/plain");
        post.setRequestBody("12345");
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
View Full Code Here


    public void testGetPlainLong() throws Exception {
        String endpointAddress =
            "http://localhost:9080/bookstore/booksplain";

        PostMethod post = new PostMethod(endpointAddress);
        post.addRequestHeader("Content-Type" , "text/plain");
        post.addRequestHeader("Accept" , "text/plain");
        post.setRequestBody("12345");
        HttpClient httpclient = new HttpClient();
       
        try {
View Full Code Here

        String endpointAddress =
            "http://localhost:9080/bookstore/booksplain";

        PostMethod post = new PostMethod(endpointAddress);
        post.addRequestHeader("Content-Type" , "text/plain");
        post.addRequestHeader("Accept" , "text/plain");
        post.setRequestBody("12345");
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
View Full Code Here

    public void testGetPlainLong() throws Exception {
        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/booksplain";

        PostMethod post = new PostMethod(endpointAddress);
        post.addRequestHeader("Content-Type" , "text/plain");
        post.addRequestHeader("Accept" , "text/plain");
        post.setRequestBody("12345");
        HttpClient httpclient = new HttpClient();
       
        try {
View Full Code Here

        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/booksplain";

        PostMethod post = new PostMethod(endpointAddress);
        post.addRequestHeader("Content-Type" , "text/plain");
        post.addRequestHeader("Accept" , "text/plain");
        post.setRequestBody("12345");
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
View Full Code Here

        } finally {
            getMethod.releaseConnection();
        }

        postMethod = new PostMethod(getBaseURI() + "/context/request/etag");
        postMethod.addRequestHeader("If-None-Match", "\"austin\", \"powers\"");
        try {
            /*
             * verifies that a request without an If-None-Match header will
             * still proceed
             */
 
View Full Code Here

        } finally {
            getMethod.releaseConnection();
        }

        postMethod = new PostMethod(getBaseURI() + "/context/request/etag");
        postMethod.addRequestHeader("If-None-Match", "\"austin\", " + setETag + " , \"powers\"");
        try {
            /*
             * verifies that a request with an If-None-Match header will fail
             */
            client.executeMethod(postMethod);
View Full Code Here

        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);

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

        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);

            assertEquals(200, postMethod.getStatusCode());
            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
View Full Code Here

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

            assertEquals(200, postMethod.getStatusCode());
            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
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.