Java Code Examples for org.springframework.http.client.ClientHttpRequestFactory

Following code examples demonstrate how to use org.springframework.http.client.ClientHttpRequestFactoryfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.http.client.ClientHttpRequestFactoryand various code implementation of this class.

    private UriPrefixingClientHttpRequestFactory(final ClientHttpRequestFactory factory, final UriPrefixer prefixer) {
        this.wrapped = notNull(factory, "factory");
        this.prefixer =  notNull(prefixer, "prefixer");
    } 


    
    public UriPrefixingClientHttpRequestFactory(final ClientHttpRequestFactory factory,
                                                final String protocol,
                                                final String hostname,
                                                final int port) {
        this(factory, UriComponentsBuilder.newInstance().scheme(protocol).host(hostname).port(port).build().toUri());
    } 

	private ClientHttpRequestFactory clientHttpRequestFactory() {
		final HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
		factory.setReadTimeout(15000);
		factory.setConnectTimeout(15000);

		return factory;
	} 

    public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setReadTimeout(5000);
        factory.setConnectTimeout(5000);
        return factory;
    }