Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpRequestWrapper


        testUnsafeMethodDoesNotInvalidateCacheForUriInContentLocationHeadersFromOtherHosts(req);
    }

    @Test
    public void testPostDoesNotInvalidateCacheForUriInLocationHeadersFromOtherHosts() throws Exception {
        final HttpRequestWrapper req = makeRequestWithBody("POST","/");
        testUnsafeMethodDoesNotInvalidateCacheForUriInLocationHeadersFromOtherHosts(req);
    }
View Full Code Here


        testUnsafeMethodDoesNotInvalidateCacheForUriInLocationHeadersFromOtherHosts(req);
    }

    @Test
    public void testDeleteDoesNotInvalidateCacheForUriInContentLocationHeadersFromOtherHosts() throws Exception {
        final HttpRequestWrapper req = HttpRequestWrapper.wrap(
                new BasicHttpRequest("DELETE", "/", HttpVersion.HTTP_1_1));
        testUnsafeMethodDoesNotInvalidateCacheForUriInContentLocationHeadersFromOtherHosts(req);
    }
View Full Code Here

        testUnsafeMethodDoesNotInvalidateCacheForUriInContentLocationHeadersFromOtherHosts(req);
    }

    @Test
    public void testDeleteDoesNotInvalidateCacheForUriInLocationHeadersFromOtherHosts() throws Exception {
        final HttpRequestWrapper req = HttpRequestWrapper.wrap(
                new BasicHttpRequest("DELETE", "/", HttpVersion.HTTP_1_1));
        testUnsafeMethodDoesNotInvalidateCacheForUriInLocationHeadersFromOtherHosts(req);
    }
View Full Code Here

     * http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.11
     */
    private void testRequestIsWrittenThroughToOrigin(final HttpRequest req)
        throws Exception {
        final HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_NO_CONTENT, "No Content");
        final HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(req);
        EasyMock.expect(
                mockBackend.execute(
                        EasyMock.eq(route),
                        eqRequest(wrapper),
                        EasyMock.isA(HttpClientContext.class),
View Full Code Here

    protected void testSharedCacheRevalidatesAuthorizedResponse(
            final HttpResponse authorizedResponse, final int minTimes, final int maxTimes) throws Exception,
            IOException {
        if (config.isSharedCache()) {
            final String authorization = "Basic dXNlcjpwYXNzd2Q=";
            final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(
                    new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
            req1.setHeader("Authorization",authorization);

            backendExpectsAnyRequestAndReturn(authorizedResponse);

            final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
                    new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
            final HttpResponse resp2 = HttpTestUtils.make200Response();
            resp2.setHeader("Cache-Control","max-age=3600");

            if (maxTimes > 0) {
View Full Code Here

            ClientProtocolException {
        if (config.isSharedCache()) {
            final String authorization1 = "Basic dXNlcjpwYXNzd2Q=";
            final String authorization2 = "Basic dXNlcjpwYXNzd2Qy";

            final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(
                    new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
            req1.setHeader("Authorization",authorization1);

            backendExpectsAnyRequestAndReturn(authorizedResponse);

            final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
                    new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
            req2.setHeader("Authorization",authorization2);

            final HttpResponse resp2 = HttpTestUtils.make200Response();

            final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
            EasyMock.expect(
View Full Code Here

    @Test
    public void testWarning110IsAddedToStaleResponses()
        throws Exception {
        final Date now = new Date();
        final Date tenSecondsAgo = new Date(now.getTime() - 10 * 1000L);
        final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(
                new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
        final HttpResponse resp1 = HttpTestUtils.make200Response();
        resp1.setHeader("Date", DateUtils.formatDate(tenSecondsAgo));
        resp1.setHeader("Cache-Control","max-age=5");
        resp1.setHeader("Etag","\"etag\"");

        backendExpectsAnyRequestAndReturn(resp1);

        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
                new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
        req2.setHeader("Cache-Control","max-stale=60");
        final HttpResponse resp2 = HttpTestUtils.make200Response();

        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
        EasyMock.expect(
                mockBackend.execute(
View Full Code Here

     *
     * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4
     */
    protected void testCacheIsNotUsedWhenRespondingToRequest(final HttpRequestWrapper req)
        throws Exception {
        final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(
                new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
        final HttpResponse resp1 = HttpTestUtils.make200Response();
        resp1.setHeader("Etag","\"etag\"");
        resp1.setHeader("Cache-Control","max-age=3600");

View Full Code Here

    }

    @Test
    public void testCacheIsNotUsedWhenRespondingToRequestWithCacheControlNoCache()
        throws Exception {
        final HttpRequestWrapper req = HttpRequestWrapper.wrap(
                new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
        req.setHeader("Cache-Control","no-cache");
        testCacheIsNotUsedWhenRespondingToRequest(req);
    }
View Full Code Here

    }

    @Test
    public void testCacheIsNotUsedWhenRespondingToRequestWithPragmaNoCache()
        throws Exception {
        final HttpRequestWrapper req = HttpRequestWrapper.wrap(
                new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
        req.setHeader("Pragma","no-cache");
        testCacheIsNotUsedWhenRespondingToRequest(req);
    }
View Full Code Here

TOP

Related Classes of org.apache.http.client.methods.HttpRequestWrapper

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.