Package org.apache.http.client

Examples of org.apache.http.client.HttpRequestRetryHandler


                request.addHeader("my-header", "stuff");
            }

        };

        final HttpRequestRetryHandler requestRetryHandler = new HttpRequestRetryHandler() {

            public boolean retryRequest(
                    final IOException exception,
                    final int executionCount,
                    final HttpContext context) {
View Full Code Here


    @Test(expected=ClientProtocolException.class)
    public void testNonRepeatableEntity() throws Exception {
        final int port = this.localServer.getServiceAddress().getPort();
        this.localServer.register("*", new SimpleService());

        final HttpRequestRetryHandler requestRetryHandler = new HttpRequestRetryHandler() {

            public boolean retryRequest(
                    final IOException exception,
                    final int executionCount,
                    final HttpContext context) {
View Full Code Here

                request.addHeader("my-header", "stuff");
            }

        };

        final HttpRequestRetryHandler requestRetryHandler = new HttpRequestRetryHandler() {

            @Override
            public boolean retryRequest(
                    final IOException exception,
                    final int executionCount,
View Full Code Here

    @Test(expected=ClientProtocolException.class)
    public void testNonRepeatableEntity() throws Exception {
        this.serverBootstrap.registerHandler("*", new SimpleService());

        final HttpRequestRetryHandler requestRetryHandler = new HttpRequestRetryHandler() {

            @Override
            public boolean retryRequest(
                    final IOException exception,
                    final int executionCount,
View Full Code Here

        execChain = decorateProtocolExec(execChain);

        // Add request retry executor, if not disabled
        if (!automaticRetriesDisabled) {
            HttpRequestRetryHandler retryHandlerCopy = this.retryHandler;
            if (retryHandlerCopy == null) {
                retryHandlerCopy = DefaultHttpRequestRetryHandler.INSTANCE;
            }
            execChain = new RetryExec(execChain, retryHandlerCopy);
        }
View Full Code Here

                request.addHeader("my-header", "stuff");
            }

        }) ;

        client.setHttpRequestRetryHandler(new HttpRequestRetryHandler() {

            public boolean retryRequest(
                    final IOException exception,
                    int executionCount,
                    final HttpContext context) {
View Full Code Here

        this.localServer.register("*", new SimpleService());

        String failureMsg = "a message showing that this failed";

        FaultyHttpClient client = new FaultyHttpClient(failureMsg);
        client.setHttpRequestRetryHandler(new HttpRequestRetryHandler() {

            public boolean retryRequest(
                    final IOException exception,
                    int executionCount,
                    final HttpContext context) {
View Full Code Here

        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
        schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
        this.mgr = new PoolingClientConnectionManager(schemeRegistry);
        this.httpclient = new DefaultHttpClient(this.mgr, params);
        this.httpclient.setHttpRequestRetryHandler(new HttpRequestRetryHandler() {

            public boolean retryRequest(
                    final IOException exception, int executionCount, final HttpContext context) {
                return false;
            }
View Full Code Here

        final Integer connectionTimeout = (int) configuration.getConnectionTimeout().toMilliseconds();
        final long keepAlive = configuration.getKeepAlive().toMilliseconds();
        final ConnectionReuseStrategy reuseStrategy = keepAlive == 0
                ? new NoConnectionReuseStrategy()
                : new DefaultConnectionReuseStrategy();
        final HttpRequestRetryHandler retryHandler = configuration.getRetries() == 0
                ? NO_RETRIES
                : (httpRequestRetryHandler == null ? new DefaultHttpRequestRetryHandler(configuration.getRetries(),
                false) : httpRequestRetryHandler);

        final RequestConfig requestConfig
View Full Code Here

                .isStaleConnectionCheckEnabled()).isFalse();
    }

    @Test
    public void usesACustomHttpRequestRetryHandler() throws Exception {
        final HttpRequestRetryHandler customHandler = new HttpRequestRetryHandler() {
            @Override
            public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
                return false;
            }
        };
View Full Code Here

TOP

Related Classes of org.apache.http.client.HttpRequestRetryHandler

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.