如何告诉WS拦截器忽略特定端点? (春天WS)

时间:2015-12-01 09:42:40

标签: java spring web-services soap spring-boot

我有以下拦截器适用于所有soap端点:

@Component
public class MySecurityInterceptor extends AbstractWsSecurityInterceptor {

    @Override
    protected void validateMessage(SoapMessage soapMessage, MessageContext messageContext)
            throws WsSecurityValidationException {}

    @Override
    protected void secureMessage(SoapMessage soapMessage, MessageContext messageContext)
            throws WsSecuritySecurementException {}

    @Override
    protected void cleanUp() {}
}

现在,我想让这个拦截器忽略一个特定的端点(假设/ws/Test.wsdl)。我怎么能这样做?

这是我的配置类:

@EnableWs
@Configuration
public class SoapWsConfig extends WsConfigurerAdapter {
    @Bean
    public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
        MessageDispatcherServlet servlet = new MessageDispatcherServlet();
        servlet.setApplicationContext(applicationContext);
        servlet.setTransformWsdlLocations(true);
        return new ServletRegistrationBean(servlet, "/ws/*");
    }

    @Bean
    public MySecurityInterceptor securityInterceptor() {
        return new MySecurityInterceptor();
    }

    @Override
    public void addInterceptors(List<EndpointInterceptor> interceptors) {
        interceptors.add(securityInterceptor());
    }
}

0 个答案:

没有答案