Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpRequestWrapper.addHeader()


        final Date tenSecondsAgo = new Date(now.getTime() - 10 * 1000L);

        impl = createCachingExecChain(mockBackend, new BasicHttpCache(), CacheConfig.DEFAULT);
        final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req1.addHeader("If-None-Match", "\"etag\"");

        final HttpResponse resp1 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
            HttpStatus.SC_NOT_MODIFIED, "Not modified");
        resp1.setHeader("Content-Length", "128");
        resp1.setHeader("ETag", "\"etag\"");
View Full Code Here


        impl = createCachingExecChain(mockBackend, new BasicHttpCache(), CacheConfig.DEFAULT);

        final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req1.addHeader("If-None-Match", "etag");

        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req2.addHeader("If-None-Match", "etag");
View Full Code Here

            "http://foo.example.com/"));
        req1.addHeader("If-None-Match", "etag");

        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req2.addHeader("If-None-Match", "etag");

        final HttpResponse resp1 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
            HttpStatus.SC_NOT_MODIFIED, "Not modified");
        resp1.setHeader("Date", DateUtils.formatDate(now));
        resp1.setHeader("Cache-Control", "max-age=0");
View Full Code Here

        impl = createCachingExecChain(mockBackend, new BasicHttpCache(), CacheConfig.DEFAULT);

        final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req1.addHeader("If-None-Match", "etag");

        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req2.addHeader("If-None-Match", "etag");
View Full Code Here

            "http://foo.example.com/"));
        req1.addHeader("If-None-Match", "etag");

        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req2.addHeader("If-None-Match", "etag");

        final HttpResponse resp1 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
            HttpStatus.SC_NOT_MODIFIED, "Not modified");
        resp1.setHeader("Date", DateUtils.formatDate(now));
        resp1.setHeader("Cache-Control", "max-age=0");
View Full Code Here

        impl = createCachingExecChain(mockBackend, new BasicHttpCache(), CacheConfig.DEFAULT);

        final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req1.addHeader("If-None-Match", "etag");

        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));

        final HttpResponse resp1 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
View Full Code Here

            this.requestCompliance.makeRequestCompliant(request);
        } catch (final ClientProtocolException e) {
            future.failed(e);
            return future;
        }
        request.addHeader(HeaderConstants.VIA,via);

        flushEntriesInvalidatedByRequest(target, request);

        if (!this.cacheableRequestPolicy.isServableFromCache(request)) {
            log.debug("Request is not servable from cache");
View Full Code Here

        request.addHeader("X-Unknown-Header", "some-value");

        final HttpRequestWrapper downgraded = HttpRequestWrapper.wrap(
                new BasicHttpRequest("GET", "/foo", HttpVersion.HTTP_1_1));
        downgraded.removeHeaders("Connection");
        downgraded.addHeader("X-Unknown-Header", "some-value");

        EasyMock.expect(
                mockBackend.execute(
                        EasyMock.isA(HttpRoute.class),
                        eqRequest(downgraded),
View Full Code Here

        resp1.setHeader(eHeader, oldVal);

        // get a head that penetrates the cache
        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
                new BasicHttpRequest("HEAD", "/", HttpVersion.HTTP_1_1));
        req2.addHeader("Cache-Control", "no-cache");
        final HttpResponse resp2 = HttpTestUtils.make200Response();
        resp2.setEntity(null);
        resp2.setHeader(eHeader, newVal);

        // next request doesn't tolerate stale entry
View Full Code Here

        resp2.setHeader(eHeader, newVal);

        // next request doesn't tolerate stale entry
        final HttpRequestWrapper req3 = HttpRequestWrapper.wrap(
                new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
        req3.addHeader("Cache-Control", "max-stale=0");
        final HttpResponse resp3 = HttpTestUtils.make200Response();
        resp3.setHeader(eHeader, newVal);

        EasyMock.expect(
                mockBackend.execute(
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.