Package org.apache.http.message

Examples of org.apache.http.message.BasicHttpEntityEnclosingRequest.addHeader()


        emptyMockCacheExpectsNoPuts();

        final BasicHttpEntityEnclosingRequest put = new BasicHttpEntityEnclosingRequest("PUT", "/",
                HttpVersion.HTTP_1_1);
        put.setEntity(HttpTestUtils.makeBody(128));
        put.addHeader("Content-Length", "128");

        originResponse.setHeader("Cache-Control", "max-age=3600");

        EasyMock.expect(
                mockBackend.execute(
View Full Code Here


    }
   
    public void testRequestContentProtocolException() throws Exception {
        HttpContext context = new HttpExecutionContext(null);
        BasicHttpRequest request1 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request1.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "chunked"));
        BasicHttpRequest request2 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request2.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "12"));

        RequestContent interceptor = new RequestContent();
        try {
View Full Code Here

    public void testRequestContentProtocolException() throws Exception {
        HttpContext context = new HttpExecutionContext(null);
        BasicHttpRequest request1 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request1.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "chunked"));
        BasicHttpRequest request2 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request2.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "12"));

        RequestContent interceptor = new RequestContent();
        try {
            interceptor.process(request1, context);
            fail("ProtocolException should have been thrown");
View Full Code Here

                    Socket socket = new Socket(host.getHostName(), host.getPort());
                    conn.bind(socket, this.client.getParams());
                }
               
                BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
                post.addHeader("Secret", Integer.toString(r));
                ByteArrayEntity outgoing = new ByteArrayEntity(
                        EncodingUtils.getAsciiBytes("No content"));
                post.setEntity(outgoing);

                HttpResponse response = this.client.execute(post, host, conn);
View Full Code Here

            public HttpRequest submitRequest(final HttpContext context) {
                int i = ((Integer) context.getAttribute("REQ-COUNT")).intValue();
                BasicHttpEntityEnclosingRequest post = null;
                if (i < reqNo) {
                    post = new BasicHttpEntityEnclosingRequest("POST", "/");
                    post.addHeader("Secret", Integer.toString(i));
                    ByteArrayEntity outgoing = new ByteArrayEntity(
                            EncodingUtils.getAsciiBytes("No content"));
                    post.setEntity(outgoing);
                   
                    context.setAttribute("REQ-COUNT", new Integer(i + 1));
View Full Code Here

                    Socket socket = new Socket(host.getHostName(), host.getPort());
                    conn.bind(socket, this.client.getParams());
                }
               
                BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
                post.addHeader("Secret", Integer.toString(r));
                ByteArrayEntity outgoing = new ByteArrayEntity(
                        EncodingUtils.getAsciiBytes("No content"));
                post.setEntity(outgoing);

                HttpResponse response = this.client.execute(post, host, conn);
View Full Code Here

    }
   
    public void testRequestContentProtocolException() throws Exception {
        HttpContext context = new BasicHttpContext(null);
        BasicHttpRequest request1 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request1.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "chunked"));
        BasicHttpRequest request2 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request2.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "12"));

        RequestContent interceptor = new RequestContent();
        try {
View Full Code Here

    public void testRequestContentProtocolException() throws Exception {
        HttpContext context = new BasicHttpContext(null);
        BasicHttpRequest request1 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request1.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "chunked"));
        BasicHttpRequest request2 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request2.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "12"));

        RequestContent interceptor = new RequestContent();
        try {
            interceptor.process(request1, context);
            fail("ProtocolException should have been thrown");
View Full Code Here

                    Socket socket = new Socket(host.getHostName(), host.getPort());
                    conn.bind(socket, this.client.getParams());
                }

                BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
                post.addHeader("Secret", Integer.toString(r));
                ByteArrayEntity outgoing = new ByteArrayEntity(
                        EncodingUtils.getAsciiBytes("No content"));
                post.setEntity(outgoing);

                HttpResponse response = this.client.execute(post, host, conn);
View Full Code Here

    @Test
    public void testRequestContentProtocolException() throws Exception {
        HttpContext context = new BasicHttpContext(null);
        BasicHttpRequest request1 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request1.addHeader(new BasicHeader(HTTP.TRANSFER_ENCODING, "chunked"));
        BasicHttpRequest request2 = new BasicHttpEntityEnclosingRequest("POST", "/");
        request2.addHeader(new BasicHeader(HTTP.CONTENT_LEN, "12"));

        RequestContent interceptor = new RequestContent();
        try {
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.