Java 类org.springframework.http.client.support.InterceptingHttpAccessor 实例源码

项目:request-correlation-spring-cloud-starter    文件:ClientHttpCorrelationConfiguration.java   
@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);
                }
            }
        }
    };
}
项目:data-acquisition    文件:RestOperationsHelpers.java   
private static void addAuthHeaderToTemplate(RestOperations restTemplate, String token) {
    ClientHttpRequestInterceptor interceptor =
        new HeaderAddingHttpInterceptor("Authorization", "bearer " + token);
    ((InterceptingHttpAccessor) restTemplate).setInterceptors(singletonList(interceptor));
}
项目:user-management    文件:RestOperationsHelpers.java   
private static void addAuthHeaderToTemplate(RestOperations restTemplate, String token) {
    ClientHttpRequestInterceptor interceptor =
        new HeaderAddingHttpInterceptor("Authorization", "bearer " + token);
    ((InterceptingHttpAccessor) restTemplate).setInterceptors(singletonList(interceptor));
}
项目:stagemonitor    文件:SpringRestTemplateContextPropagatingTransformer.java   
@Advice.OnMethodExit(inline = false)
public static void onInterceptingHttpAccessorCreated(@Advice.This InterceptingHttpAccessor httpAccessor) {
    final TracingPlugin tracingPlugin = Stagemonitor.getPlugin(TracingPlugin.class);
    httpAccessor.getInterceptors().add(new SpringRestTemplateContextPropagatingInterceptor(tracingPlugin));
}