org.springframework.http.client.support.InterceptingHttpAccessor Java Examples
The following examples show how to use
org.springframework.http.client.support.InterceptingHttpAccessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientHttpCorrelationConfiguration.java From request-correlation-spring-cloud-starter with Apache License 2.0 | 6 votes |
@Bean public InitializingBean clientsCorrelationInitializer(final RequestCorrelationProperties properties) { return new InitializingBean() { @Override 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); } } } }; }
Example #2
Source File: RestTemplateTracingAutoConfiguration.java From java-spring-web with Apache License 2.0 | 5 votes |
public RestTemplatePostProcessingConfiguration(Tracer tracer, List<RestTemplateSpanDecorator> spanDecorators, Set<InterceptingHttpAccessor> restTemplates) { this.tracer = tracer; this.spanDecorators = spanDecorators; this.restTemplates = restTemplates; }
Example #3
Source File: RestTemplateTracingAutoConfiguration.java From java-spring-web with Apache License 2.0 | 5 votes |
private void registerTracingInterceptor(InterceptingHttpAccessor restTemplate) { List<ClientHttpRequestInterceptor> interceptors = restTemplate.getInterceptors(); for (ClientHttpRequestInterceptor interceptor : interceptors) { if (interceptor instanceof TracingRestTemplateInterceptor) { return; } } log.debug("Adding " + TracingRestTemplateInterceptor.class.getSimpleName() + " to " + restTemplate); interceptors = new ArrayList<>(interceptors); interceptors.add(new TracingRestTemplateInterceptor(tracer, spanDecorators)); restTemplate.setInterceptors(interceptors); }
Example #4
Source File: RestTemplateTracingAutoConfiguration.java From java-spring-web with Apache License 2.0 | 4 votes |
@PostConstruct public void init() { for (InterceptingHttpAccessor restTemplate : restTemplates) { registerTracingInterceptor(restTemplate); } }