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


            final HttpContext context)
                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);
            }
        }
    }

    protected void postprocessResponse(
View Full Code Here

            final HttpContext context)
            throws IOException, HttpException {
        for (int i = 0; i < this.requestInterceptors.size(); i++) {
            HttpRequestInterceptor interceptor =
                (HttpRequestInterceptor) this.requestInterceptors.get(i);
            interceptor.process(request, context);
        }
    }
   
    public void process(
            final HttpResponse response,
View Full Code Here

        authCache.put(this.proxy, this.authscheme2);

        context.setAttribute(HttpClientContext.AUTH_CACHE, authCache);

        final HttpRequestInterceptor interceptor = new RequestAuthCache();
        interceptor.process(request, context);
        Assert.assertNull(this.targetState.getAuthScheme());
        Assert.assertNull(this.targetState.getCredentials());
        Assert.assertNull(this.proxyState.getAuthScheme());
        Assert.assertNull(this.proxyState.getCredentials());
    }
View Full Code Here

        this.targetState.update(new BasicScheme(), new UsernamePasswordCredentials("user3", "secret3"));
        this.proxyState.setState(AuthProtocolState.CHALLENGED);
        this.proxyState.update(new BasicScheme(), new UsernamePasswordCredentials("user4", "secret4"));

        final HttpRequestInterceptor interceptor = new RequestAuthCache();
        interceptor.process(request, context);
        Assert.assertNotSame(this.authscheme1, this.targetState.getAuthScheme());
        Assert.assertNotSame(this.creds1, this.targetState.getCredentials());
        Assert.assertNotSame(this.authscheme2, this.proxyState.getAuthScheme());
        Assert.assertNotSame(this.creds2, this.proxyState.getCredentials());
    }
View Full Code Here

            final HttpContext context)
            throws IOException, HttpException {
        for (int i = 0; i < this.requestInterceptors.size(); i++) {
            HttpRequestInterceptor interceptor =
                this.requestInterceptors.get(i);
            interceptor.process(request, context);
        }
    }

    public void process(
            final HttpResponse response,
View Full Code Here

    @Test(expected=IllegalArgumentException.class)
    public void testRequestParameterCheck() throws Exception {
        final HttpClientContext context = HttpClientContext.create();
        final HttpRequestInterceptor interceptor = new RequestAuthCache();
        interceptor.process(null, context);
    }

    @Test(expected=IllegalArgumentException.class)
    public void testContextParameterCheck() throws Exception {
        final HttpRequest request = new BasicHttpRequest("GET", "/");
View Full Code Here

    @Test(expected=IllegalArgumentException.class)
    public void testContextParameterCheck() throws Exception {
        final HttpRequest request = new BasicHttpRequest("GET", "/");
        final HttpRequestInterceptor interceptor = new RequestAuthCache();
        interceptor.process(request, null);
    }

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

        authCache.put(this.proxy, this.authscheme2);

        context.setAttribute(HttpClientContext.AUTH_CACHE, authCache);

        final HttpRequestInterceptor interceptor = new RequestAuthCache();
        interceptor.process(request, context);
        Assert.assertSame(this.authscheme1, this.targetState.getAuthScheme());
        Assert.assertSame(this.creds1, this.targetState.getCredentials());
        Assert.assertSame(this.authscheme2, this.proxyState.getAuthScheme());
        Assert.assertSame(this.creds2, this.proxyState.getCredentials());
    }
View Full Code Here

        authCache.put(this.proxy, this.authscheme2);

        context.setAttribute(HttpClientContext.AUTH_CACHE, authCache);

        final HttpRequestInterceptor interceptor = new RequestAuthCache();
        interceptor.process(request, context);
        Assert.assertNull(this.targetState.getAuthScheme());
        Assert.assertNull(this.targetState.getCredentials());
        Assert.assertNull(this.proxyState.getAuthScheme());
        Assert.assertNull(this.proxyState.getCredentials());
    }
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.