Spring Web Services Framework

org.springframework.ws.server
Interface EndpointInterceptor

All Known Subinterfaces:
SoapEndpointInterceptor
All Known Implementing Classes:
AbstractFaultCreatingValidatingInterceptor, AbstractLoggingInterceptor, AbstractValidatingInterceptor, AbstractWsSecurityInterceptor, EndpointInterceptorAdapter, PayloadLoggingInterceptor, PayloadTransformingInterceptor, PayloadValidatingInterceptor, SoapEnvelopeLoggingInterceptor, Wss4jSecurityInterceptor, XwsSecurityInterceptor

public interface EndpointInterceptor

Workflow interface that allows for customized endpoint invocation chains. Applications can register any number of existing or custom interceptors for certain groups of endpoints, to add common preprocessing behavior without needing to modify each endpoint implementation.

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:
EndpointInvocationChain.getInterceptors(), EndpointInterceptorAdapter, AbstractEndpointMapping.setInterceptors(EndpointInterceptor[])

Method Summary
 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 Detail

handleRequest

boolean handleRequest(MessageContext messageContext,
                      Object endpoint)
                      throws Exception
Processes the incoming request message. Called after EndpointMapping determined an appropriate endpoint object, but before EndpointAdapter 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 message
endpoint - 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:
MessageContext.getRequest()

handleResponse

boolean handleResponse(MessageContext messageContext,
                       Object endpoint)
                       throws Exception
Processes the outgoing response message. Called after EndpointAdapter 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
endpoint - chosen endpoint to invoke
Returns:
true to continue processing of the reponse interceptor chain; false to indicate blocking of the response endpoint chain.
Throws:
Exception - in case of errors
See Also:
MessageContext.getRequest(), MessageContext.hasResponse(), MessageContext.getResponse()

handleFault

boolean handleFault(MessageContext messageContext,
                    Object endpoint)
                    throws Exception
Processes the outgoing response fault. Called after EndpointAdapter 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 Fault
endpoint - chosen endpoint to invoke
Returns:
true to continue processing of the reponse interceptor chain; false to indicate blocking of the response handler chain.
Throws:
Exception

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.