Search in sources :

Example 1 with TracingClientHttpRequestInterceptor

use of brave.spring.web.TracingClientHttpRequestInterceptor in project spring-cloud-sleuth by spring-cloud.

the class TraceUserInfoRestTemplateCustomizer method customize.

@Override
public void customize(OAuth2RestTemplate template) {
    final TracingClientHttpRequestInterceptor interceptor = this.beanFactory.getBean(TracingClientHttpRequestInterceptor.class);
    new RestTemplateInterceptorInjector(interceptor).inject(template);
    if (this.delegate != null) {
        ((UserInfoRestTemplateCustomizer) this.delegate).customize(template);
    }
}
Also used : TracingClientHttpRequestInterceptor(brave.spring.web.TracingClientHttpRequestInterceptor) UserInfoRestTemplateCustomizer(org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoRestTemplateCustomizer)

Example 2 with TracingClientHttpRequestInterceptor

use of brave.spring.web.TracingClientHttpRequestInterceptor in project spring-cloud-sleuth by spring-cloud.

the class MySecondClientHttpRequestInterceptor method assertInterceptorsOrder.

private void assertInterceptorsOrder(List<ClientHttpRequestInterceptor> interceptors) {
    int traceInterceptorIndex = -1;
    int myInterceptorIndex = -1;
    int mySecondInterceptorIndex = -1;
    for (int i = 0; i < interceptors.size(); i++) {
        ClientHttpRequestInterceptor interceptor = interceptors.get(i);
        if (interceptor instanceof TracingClientHttpRequestInterceptor || interceptor instanceof LazyTracingClientHttpRequestInterceptor) {
            traceInterceptorIndex = i;
        } else if (interceptor instanceof MyClientHttpRequestInterceptor) {
            myInterceptorIndex = i;
        } else if (interceptor instanceof MySecondClientHttpRequestInterceptor) {
            mySecondInterceptorIndex = i;
        }
    }
    then(traceInterceptorIndex).isGreaterThanOrEqualTo(0).isLessThan(myInterceptorIndex).isLessThan(mySecondInterceptorIndex);
}
Also used : TracingClientHttpRequestInterceptor(brave.spring.web.TracingClientHttpRequestInterceptor) TracingClientHttpRequestInterceptor(brave.spring.web.TracingClientHttpRequestInterceptor) ClientHttpRequestInterceptor(org.springframework.http.client.ClientHttpRequestInterceptor)

Aggregations

TracingClientHttpRequestInterceptor (brave.spring.web.TracingClientHttpRequestInterceptor)2 UserInfoRestTemplateCustomizer (org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoRestTemplateCustomizer)1 ClientHttpRequestInterceptor (org.springframework.http.client.ClientHttpRequestInterceptor)1