views:

350

answers:

1

I have two endpoints using annotations. I want to apply different interceptors to each of them. (one being a secure interceptor and the other not being secure) Is there a way to do this using PayloadRootAnnotationMethodEndpointMapping? Anyone have an idea?

According to the applicationContext-ws.xml of the airline example that comes with Spring:

The endpoint mappings map from a request to an endpoint. Because we only want the security interception to occur for the GetFrequentFlyerMileageEndpoint, we define two mappings: one with the securityInterceptor, and a general one without it.

So is the only way to do this is to have two different mappings: org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping and org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping for the secure ones?

A: 

When you give an interceptor set to an EndpointMapping, then those interceptors will apply to all Endpoints mapped by that EndpointMapping. So if you want some Endpoints to get a different set of interceptors to other Endpoints, then yes, you need two different EndpointMapping beans, one with the secure interceptor and mapping to the secure endpoints, and another with no interceptors and mapping to the unsecured endpoints.

Which EndpointMapping implementations you use is dependent on the application and which kinds of Endpoints it uses.

skaffman