Example usage for org.springframework.http.client.support InterceptingHttpAccessor getInterceptors

List of usage examples for org.springframework.http.client.support InterceptingHttpAccessor getInterceptors

Introduction

In this page you can find the example usage for org.springframework.http.client.support InterceptingHttpAccessor getInterceptors.

Prototype

public List<ClientHttpRequestInterceptor> getInterceptors() 

Source Link

Document

Return the request interceptors that this accessor uses.

Usage

From source file:io.jmnarloch.spring.request.correlation.http.ClientHttpCorrelationConfiguration.java

@Bean
public InitializingBean clientsCorrelationInitializer(final RequestCorrelationProperties properties) {

    return new InitializingBean() {
        @Override//from w  w w  .ja va 2  s .c  om
        public void afterPropertiesSet() throws Exception {

            if (clients != null) {
                for (InterceptingHttpAccessor client : clients) {
                    final List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
                            client.getInterceptors());
                    interceptors.add(new ClientHttpRequestCorrelationInterceptor(properties));
                    client.setInterceptors(interceptors);
                }
            }
        }
    };
}