Package org.apache.http

Examples of org.apache.http.HttpRequestInterceptor.process()


            throws IOException, HttpException {
        if (this.requestInterceptors != null) {
            for (int i = 0; i < this.requestInterceptors.size(); i++) {
                HttpRequestInterceptor interceptor =
                    (HttpRequestInterceptor) this.requestInterceptors.get(i);
                interceptor.process(request, context);
            }
        }
    }
   
    // non-Javadoc, see interface HttpResponseInterceptor (via HttpProcessor)
View Full Code Here


        context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);

        final Header[] headers1 = request.getHeaders(SM.COOKIE);
        Assert.assertNotNull(headers1);
        Assert.assertEquals(0, headers1.length);
        final Header[] headers2 = request.getHeaders(SM.COOKIE2);
View Full Code Here

        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, null);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);

        final Header[] headers1 = request.getHeaders(SM.COOKIE);
        Assert.assertNotNull(headers1);
        Assert.assertEquals(0, headers1.length);
        final Header[] headers2 = request.getHeaders(SM.COOKIE2);
View Full Code Here

        context.setAttribute(HttpClientContext.REQUEST_CONFIG, config);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);

        final CookieSpec cookieSpec = context.getCookieSpec();
        Assert.assertTrue(cookieSpec instanceof BrowserCompatSpec);

        final Header[] headers1 = request.getHeaders(SM.COOKIE);
View Full Code Here

        context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);
    }

    @Test
    public void testAuthScopeRemotePortWhenDirect() throws Exception {
        final HttpRequest request = new BasicHttpRequest("GET", "/stuff");
View Full Code Here

        context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);

        final CookieOrigin cookieOrigin = context.getCookieOrigin();
        Assert.assertNotNull(cookieOrigin);
        Assert.assertEquals(this.target.getHostName(), cookieOrigin.getHost());
        Assert.assertEquals(1234, cookieOrigin.getPort());
View Full Code Here

        context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);

        final CookieOrigin cookieOrigin = context.getCookieOrigin();
        Assert.assertNotNull(cookieOrigin);
        Assert.assertEquals(this.target.getHostName(), cookieOrigin.getHost());
        Assert.assertEquals(80, cookieOrigin.getPort());
View Full Code Here

        context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);

        final CookieOrigin cookieOrigin = context.getCookieOrigin();
        Assert.assertNotNull(cookieOrigin);
        Assert.assertEquals(this.target.getHostName(), cookieOrigin.getHost());
        Assert.assertEquals(443, cookieOrigin.getPort());
View Full Code Here

        context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);

        final Header[] headers1 = request.getHeaders(SM.COOKIE);
        Assert.assertNotNull(headers1);
        Assert.assertEquals(2, headers1.length);
        Assert.assertEquals("$Version=1; name1=\"value1\"", headers1[0].getValue());
View Full Code Here

        context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
        context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);

        final HttpRequestInterceptor interceptor = new RequestAddCookies();
        interceptor.process(request, context);

        final Header[] headers1 = request.getHeaders(SM.COOKIE);
        Assert.assertNotNull(headers1);
        Assert.assertEquals(0, headers1.length);
        final Header[] headers2 = request.getHeaders(SM.COOKIE2);
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.