Interface EndpointInterceptor
- All Known Subinterfaces:
SmartEndpointInterceptor
,SmartSoapEndpointInterceptor
,SoapEndpointInterceptor
- All Known Implementing Classes:
AbstractFaultCreatingValidatingInterceptor
,AbstractLoggingInterceptor
,AbstractValidatingInterceptor
,AbstractWsSecurityInterceptor
,DelegatingSmartEndpointInterceptor
,DelegatingSmartSoapEndpointInterceptor
,EndpointInterceptorAdapter
,PayloadLoggingInterceptor
,PayloadRootSmartSoapEndpointInterceptor
,PayloadTransformingInterceptor
,PayloadValidatingInterceptor
,SoapActionSmartEndpointInterceptor
,SoapEnvelopeLoggingInterceptor
,Wss4jSecurityInterceptor
An EndpointInterceptor
gets called before the appropriate EndpointAdapter
triggers the invocation of
the endpoint itself. This mechanism can be used for a large field of preprocessing aspects, e.g. for authorization
checks, or message header checks. Its main purpose is to allow for factoring out repetitive endpoint code.
Typically an interceptor chain is defined per EndpointMapping
bean, sharing its granularity. To be able to
apply a certain interceptor chain to a group of handlers, one needs to map the desired handlers via one
EndpointMapping
bean. The interceptors themselves are defined as beans in the application context, referenced
by the mapping bean definition via its interceptors
property (in XML: a <list> of <ref>).
- Since:
- 1.0.0
- Author:
- Arjen Poutsma
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterCompletion
(MessageContext messageContext, Object endpoint, Exception ex) Callback after completion of request and response (fault) processing.boolean
handleFault
(MessageContext messageContext, Object endpoint) Processes the outgoing response fault.boolean
handleRequest
(MessageContext messageContext, Object endpoint) Processes the incoming request message.boolean
handleResponse
(MessageContext messageContext, Object endpoint) Processes the outgoing response message.
-
Method Details
-
handleRequest
Processes the incoming request message. Called afterEndpointMapping
determined an appropriate endpoint object, but beforeEndpointAdapter
invokes the endpoint.MessageDispatcher
processes an endpoint in an invocation chain, consisting of any number of interceptors, with the endpoint itself at the end. With this method, each interceptor can decide to abort the chain, typically creating a custom response.- Parameters:
messageContext
- contains the incoming request messageendpoint
- chosen endpoint to invoke- Returns:
true
to continue processing of the request interceptor chain;false
to indicate blocking of the request endpoint chain, without invoking the endpoint- Throws:
Exception
- in case of errors- See Also:
-
handleResponse
Processes the outgoing response message. Called afterEndpointAdapter
actually invoked the endpoint. Can manipulate the response, if any, by adding new headers, etc.MessageDispatcher
processes an endpoint in an invocation chain, consisting of any number of interceptors, with the endpoint itself at the end. With this method, each interceptor can post-process an invocation, getting applied in inverse order of the execution chain.Note: Will only be called if this interceptor's
handleRequest(org.springframework.ws.context.MessageContext, java.lang.Object)
method has successfully completed.- Parameters:
messageContext
- contains both request and response messagesendpoint
- chosen endpoint to invoke- Returns:
true
to continue processing of the response interceptor chain;false
to indicate blocking of the response endpoint chain.- Throws:
Exception
- in case of errors- See Also:
-
handleFault
Processes the outgoing response fault. Called afterEndpointAdapter
actually invoked the endpoint. Can manipulate the response, if any, by adding new headers, etc.MessageDispatcher
processes an endpoint in an invocation chain, consisting of any number of interceptors, with the endpoint itself at the end. With this method, each interceptor can post-process an invocation, getting applied in inverse order of the execution chain.Note: Will only be called if this interceptor's
handleRequest(org.springframework.ws.context.MessageContext, java.lang.Object)
method has successfully completed.- Parameters:
messageContext
- contains both request and response messages, the response should contains a Faultendpoint
- chosen endpoint to invoke- Returns:
true
to continue processing of the response interceptor chain;false
to indicate blocking of the response handler chain.- Throws:
Exception
-
afterCompletion
Callback after completion of request and response (fault) processing. Will be called on any outcome of endpoint invocation, thus allows for proper resource cleanup.Note: Will only be called if this interceptor's
handleRequest(org.springframework.ws.context.MessageContext, java.lang.Object)
method has successfully completed.As with the
handleResponse(org.springframework.ws.context.MessageContext, java.lang.Object)
method, the method will be invoked on each interceptor in the chain in reverse order, so the first interceptor will be the last to be invoked.- Parameters:
messageContext
- contains both request and response messages, the response should contains a Faultendpoint
- chosen endpoint to invokeex
- exception thrown on handler execution, if any- Throws:
Exception
- in case of errors- Since:
- 2.0.2
-