Package com.sun.jersey.client.apache4.config

Examples of com.sun.jersey.client.apache4.config.DefaultApacheHttpClient4Config


    private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration) {
        HttpClient httpClient = new HttpClientBuilder().using(configuration).build();
        ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
        ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
        config.getSingletons().add(new JacksonMessageBodyProvider(new ObjectMapperFactory().build(), new Validator()));
        return new ApacheHttpClient4(handler, config);
    }
View Full Code Here


            }

            JerseyUtil.addHandlers(clientConfig, readers, writers);

            // create the client
            ApacheHttpClient4 client = ApacheHttpClient4.create(clientConfig);

            // do not use Apache's retry handler
            ((AbstractHttpClient) client.getClientHandler().getHttpClient()).setHttpRequestRetryHandler(
                    new DefaultHttpRequestRetryHandler(0, false));

            JerseyUtil.addFilters(client, config);

            return client;
View Full Code Here

            }

            JerseyUtil.addHandlers(clientConfig, readers, writers);

            // create the client
            ApacheHttpClient4 client = ApacheHttpClient4.create(clientConfig);
            AbstractHttpClient httpClient = (AbstractHttpClient) client.getClientHandler().getHttpClient();

            // do not use Apache's retry handler
            httpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false));

            // use a RoutePlanner/ProxySelector that fits our requirements
View Full Code Here

        HttpClient httpClient = new HttpClientBuilder(metrics).using(configuration).build("calculator");
        ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
        ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
        Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
        config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), validator));
        return new ApacheHttpClient4(handler, config);
    }
View Full Code Here

    private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration) {
        HttpClient httpClient = new HttpClientBuilder().using(configuration).build();
        ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
        ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
        config.getSingletons().add(new JacksonMessageBodyProvider(new ObjectMapperFactory().build(), new Validator()));
        return new ApacheHttpClient4(handler, config);
    }
View Full Code Here

    }

    private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration,
                                                               MetricRegistry metrics) {
        HttpClient httpClient = new HttpClientBuilder(metrics).using(configuration).build("dictionary");
        ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
        ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
        Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
        config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), validator));
        return new ApacheHttpClient4(handler, config);
    }
View Full Code Here

        _client = jerseyClient;
    }

    private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration) {
        HttpClient httpClient = new HttpClientBuilder().using(configuration).build();
        ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
        ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
        config.getSingletons().add(new JacksonMessageBodyProvider(new ObjectMapper(), new Validator()));
        return new ApacheHttpClient4(handler, config);
    }
View Full Code Here

    cm.setMaxTotal(1000);
    // Increase default max connection per route
    cm.setDefaultMaxPerRoute(1000);

    HttpClient httpClient = new DefaultHttpClient(cm);
    client = new ApacheHttpClient4(new ApacheHttpClient4Handler(httpClient, null, false), clientConfig);

    client.setReadTimeout(10000);
    //Experimental support for unix sockets:
    //client = new UnixSocketClient(clientConfig);
View Full Code Here

    cm.setMaxTotal(1000);
    // Increase default max connection per route
    cm.setDefaultMaxPerRoute(1000);

    HttpClient httpClient = new DefaultHttpClient(cm);
    client = new ApacheHttpClient4(new ApacheHttpClient4Handler(httpClient, null, false), clientConfig);

    client.setReadTimeout(10000);
    //Experimental support for unix sockets:
    //client = new UnixSocketClient(clientConfig);
View Full Code Here

    cm.setMaxTotal(1000);
    // Increase default max connection per route
    cm.setDefaultMaxPerRoute(1000);

    HttpClient httpClient = new DefaultHttpClient(cm);
    client = new ApacheHttpClient4(new ApacheHttpClient4Handler(httpClient, null, false), clientConfig);

    client.setReadTimeout(10000);
    //Experimental support for unix sockets:
    //client = new UnixSocketClient(clientConfig);
View Full Code Here

TOP

Related Classes of com.sun.jersey.client.apache4.config.DefaultApacheHttpClient4Config

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.