本文整理汇总了Java中org.springframework.http.client.support.InterceptingHttpAccessor类的典型用法代码示例。如果您正苦于以下问题:Java InterceptingHttpAccessor类的具体用法?Java InterceptingHttpAccessor怎么用?Java InterceptingHttpAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InterceptingHttpAccessor类属于org.springframework.http.client.support包,在下文中一共展示了InterceptingHttpAccessor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: clientsCorrelationInitializer
import org.springframework.http.client.support.InterceptingHttpAccessor; //导入依赖的package包/类
@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);
}
}
}
};
}
开发者ID:jmnarloch,项目名称:request-correlation-spring-cloud-starter,代码行数:18,代码来源:ClientHttpCorrelationConfiguration.java
示例2: addAuthHeaderToTemplate
import org.springframework.http.client.support.InterceptingHttpAccessor; //导入依赖的package包/类
private static void addAuthHeaderToTemplate(RestOperations restTemplate, String token) {
ClientHttpRequestInterceptor interceptor =
new HeaderAddingHttpInterceptor("Authorization", "bearer " + token);
((InterceptingHttpAccessor) restTemplate).setInterceptors(singletonList(interceptor));
}
开发者ID:trustedanalytics,项目名称:data-acquisition,代码行数:6,代码来源:RestOperationsHelpers.java
示例3: onInterceptingHttpAccessorCreated
import org.springframework.http.client.support.InterceptingHttpAccessor; //导入依赖的package包/类
@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));
}
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:6,代码来源:SpringRestTemplateContextPropagatingTransformer.java
注:本文中的org.springframework.http.client.support.InterceptingHttpAccessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论