本文整理了Java中org.springframework.ws.client.core.WebServiceTemplate.setInterceptors()
方法的一些代码示例,展示了WebServiceTemplate.setInterceptors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebServiceTemplate.setInterceptors()
方法的具体详情如下:
包路径:org.springframework.ws.client.core.WebServiceTemplate
类名称:WebServiceTemplate
方法名:setInterceptors
[英]Sets the client interceptors to apply to all web service invocations made by this template.
[中]将客户端拦截器设置为应用于此模板进行的所有web服务调用。
代码示例来源:origin: org.springframework.boot/spring-boot
/**
* Configure the provided {@link WebServiceTemplate} instance using this builder.
* @param <T> the type of web service template
* @param webServiceTemplate the {@link WebServiceTemplate} to configure
* @return the web service template instance
* @see #build()
* @see #build(Class)
*/
public <T extends WebServiceTemplate> T configure(T webServiceTemplate) {
Assert.notNull(webServiceTemplate, "WebServiceTemplate must not be null");
configureMessageSenders(webServiceTemplate);
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
applyCustomizers(webServiceTemplate, this.internalCustomizers);
map.from(this.marshaller).to(webServiceTemplate::setMarshaller);
map.from(this.unmarshaller).to(webServiceTemplate::setUnmarshaller);
map.from(this.destinationProvider).to(webServiceTemplate::setDestinationProvider);
map.from(this.transformerFactoryClass)
.to(webServiceTemplate::setTransformerFactoryClass);
map.from(this.messageFactory).to(webServiceTemplate::setMessageFactory);
if (!CollectionUtils.isEmpty(this.interceptors)) {
Set<ClientInterceptor> merged = new LinkedHashSet<>(this.interceptors);
if (webServiceTemplate.getInterceptors() != null) {
merged.addAll(Arrays.asList(webServiceTemplate.getInterceptors()));
}
webServiceTemplate.setInterceptors(merged.toArray(new ClientInterceptor[0]));
}
applyCustomizers(webServiceTemplate, this.customizers);
return webServiceTemplate;
}
代码示例来源:origin: spring-projects/spring-integration
public void setInterceptors(ClientInterceptor... interceptors) {
Assert.state(!this.webServiceTemplateExplicitlySet,
() -> "'interceptors' must be specified on the provided: " + this.webServiceTemplate);
this.webServiceTemplate.setInterceptors(interceptors);
}
代码示例来源:origin: spring-projects/spring-ws
/** Sets the {@code ClientInterceptors} used by the gateway. */
public final void setInterceptors(ClientInterceptor[] interceptors) {
webServiceTemplate.setInterceptors(interceptors);
}
代码示例来源:origin: apache/servicemix-bundles
/** Sets the {@code ClientInterceptors} used by the gateway. */
public final void setInterceptors(ClientInterceptor[] interceptors) {
webServiceTemplate.setInterceptors(interceptors);
}
代码示例来源:origin: org.springframework.ws/spring-ws-core
/** Sets the {@code ClientInterceptors} used by the gateway. */
public final void setInterceptors(ClientInterceptor[] interceptors) {
webServiceTemplate.setInterceptors(interceptors);
}
代码示例来源:origin: org.springframework.ws/org.springframework.ws
/** Sets the <code>ClientInterceptors</code> used by the gateway. */
public final void setInterceptors(ClientInterceptor[] interceptors) {
webServiceTemplate.setInterceptors(interceptors);
}
代码示例来源:origin: com.consol.citrus/citrus-ws
/**
* Sets the client interceptors.
* @param interceptors
*/
public void setInterceptors(List<ClientInterceptor> interceptors) {
this.interceptors = interceptors;
getWebServiceTemplate().setInterceptors(interceptors.toArray(new ClientInterceptor[interceptors.size()]));
}
代码示例来源:origin: com.consol.citrus/citrus-ws
/**
* Sets the single client interceptor.
* @param interceptor
*/
public void setInterceptor(ClientInterceptor interceptor) {
this.interceptor = interceptor;
getWebServiceTemplate().setInterceptors(new ClientInterceptor[] { interceptor });
}
代码示例来源:origin: tracee/tracee
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof WebServiceTemplate) {
final WebServiceTemplate webServiceTemplate = (WebServiceTemplate)bean;
final ClientInterceptor[] interceptors = webServiceTemplate.getInterceptors();
final ClientInterceptor[] newInterceptors;
if (interceptors != null) {
newInterceptors = Arrays.copyOf(interceptors, interceptors.length+1);
} else {
newInterceptors = new ClientInterceptor[1];
}
newInterceptors[newInterceptors.length-1] = interceptor;
webServiceTemplate.setInterceptors(newInterceptors);
}
return bean;
}
@Override
代码示例来源:origin: net.javacrumbs/smock-springws
/**
* Creates a {@code MockWebServiceServer} instance based on the given {@link WebServiceTemplate}.
* Supports interceptors that will be applied on the incomming message. Please note that acctually the interceptoes will
* be added to the {@link ClientInterceptor} set on the client side. it's an ugly hack, but that's the only way to do it
* without reimplementing the whole testing library. I hope it will change in next releases.
*
* @param webServiceTemplate the web service template
* @return the created server
*/
public static MockWebServiceServer createServer(WebServiceTemplate webServiceTemplate, EndpointInterceptor[] interceptors) {
if (interceptors!=null && interceptors.length>0)
{
List<ClientInterceptor> newInterceptors = new ArrayList<ClientInterceptor>();
if (webServiceTemplate.getInterceptors()!=null)
{
newInterceptors.addAll(Arrays.asList(webServiceTemplate.getInterceptors()));
}
newInterceptors.addAll(Arrays.asList(EndpointInterceptorClientAdapter.wrapEndpointInterceptors(interceptors)));
webServiceTemplate.setInterceptors(newInterceptors.toArray(new ClientInterceptor[newInterceptors.size()]));
}
return MockWebServiceServer.createServer(webServiceTemplate);
}
代码示例来源:origin: code-not-found/spring-ws
@Bean
public WebServiceTemplate webServiceTemplate() throws Exception {
WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
webServiceTemplate.setMarshaller(jaxb2Marshaller());
webServiceTemplate.setUnmarshaller(jaxb2Marshaller());
webServiceTemplate.setDefaultUri(defaultUri);
// register the signatureSecurityInterceptor
ClientInterceptor[] interceptors = new ClientInterceptor[] {clientSecurityInterceptor()};
webServiceTemplate.setInterceptors(interceptors);
return webServiceTemplate;
}
代码示例来源:origin: code-not-found/spring-ws
@Bean
public WebServiceTemplate webServiceTemplate() {
WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
webServiceTemplate.setMarshaller(jaxb2Marshaller());
webServiceTemplate.setUnmarshaller(jaxb2Marshaller());
webServiceTemplate.setDefaultUri(defaultUri);
// register the LogHttpHeaderClientInterceptor
ClientInterceptor[] interceptors =
new ClientInterceptor[] {new LogHttpHeaderClientInterceptor()};
webServiceTemplate.setInterceptors(interceptors);
return webServiceTemplate;
}
}
代码示例来源:origin: code-not-found/spring-ws
@Bean
public WebServiceTemplate webServiceTemplate() throws Exception {
WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
webServiceTemplate.setMarshaller(jaxb2Marshaller());
webServiceTemplate.setUnmarshaller(jaxb2Marshaller());
webServiceTemplate.setDefaultUri(defaultUri);
// register the signatureSecurityInterceptor
ClientInterceptor[] interceptors = new ClientInterceptor[] {clientSecurityInterceptor()};
webServiceTemplate.setInterceptors(interceptors);
return webServiceTemplate;
}
内容来源于网络,如有侵权,请联系作者删除!