Spring Web Services Framework

org.springframework.ws.server.endpoint.interceptor
Class DelegatingSmartEndpointInterceptor

java.lang.Object
  extended by org.springframework.ws.server.endpoint.interceptor.DelegatingSmartEndpointInterceptor
All Implemented Interfaces:
EndpointInterceptor, SmartEndpointInterceptor
Direct Known Subclasses:
DelegatingSmartSoapEndpointInterceptor

public class DelegatingSmartEndpointInterceptor
extends Object
implements SmartEndpointInterceptor

Implementation of the SmartEndpointInterceptor interface that delegates to a delegate EndpointInterceptor.

Since:
2.0
Author:
Arjen Poutsma

Constructor Summary
DelegatingSmartEndpointInterceptor(EndpointInterceptor delegate)
          Creates a new instance of the DelegatingSmartEndpointInterceptor with the given delegate.
 
Method Summary
 void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex)
          Callback after completion of request and response (fault) processing.
 EndpointInterceptor getDelegate()
          Returns the delegate.
 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.
 boolean shouldIntercept(MessageContext messageContext, Object endpoint)
          Indicates whether this interceptor should intercept the given message context.
protected  boolean shouldIntercept(WebServiceMessage request, Object endpoint)
          Indicates whether this interceptor should intercept the given request message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingSmartEndpointInterceptor

public DelegatingSmartEndpointInterceptor(EndpointInterceptor delegate)
Creates a new instance of the DelegatingSmartEndpointInterceptor with the given delegate.

Parameters:
delegate - the endpoint interceptor to delegate to.
Method Detail

getDelegate

public EndpointInterceptor getDelegate()
Returns the delegate.

Returns:
the delegate

shouldIntercept

public boolean shouldIntercept(MessageContext messageContext,
                               Object endpoint)
Indicates whether this interceptor should intercept the given message context.

This implementation delegates to shouldIntercept(WebServiceMessage, Object).

Specified by:
shouldIntercept in interface SmartEndpointInterceptor
Parameters:
messageContext - contains the incoming request message
endpoint - chosen endpoint to invoke
Returns:
true to indicate that this interceptor applies; false otherwise

shouldIntercept

protected boolean shouldIntercept(WebServiceMessage request,
                                  Object endpoint)
Indicates whether this interceptor should intercept the given request message.

This implementation always returns true.

Parameters:
request - the request message
endpoint - chosen endpoint to invoke
Returns:
true to indicate that this interceptor applies; false otherwise

handleRequest

public boolean handleRequest(MessageContext messageContext,
                             Object endpoint)
                      throws Exception
Description copied from interface: EndpointInterceptor
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.

Specified by:
handleRequest in interface EndpointInterceptor
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

public boolean handleResponse(MessageContext messageContext,
                              Object endpoint)
                       throws Exception
Description copied from interface: EndpointInterceptor
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 EndpointInterceptor.handleRequest(org.springframework.ws.context.MessageContext, java.lang.Object) method has successfully completed.

Specified by:
handleResponse in interface EndpointInterceptor
Parameters:
messageContext - contains both request and response messages
endpoint - 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:
MessageContext.getRequest(), MessageContext.hasResponse(), MessageContext.getResponse()

handleFault

public boolean handleFault(MessageContext messageContext,
                           Object endpoint)
                    throws Exception
Description copied from interface: EndpointInterceptor
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 EndpointInterceptor.handleRequest(org.springframework.ws.context.MessageContext, java.lang.Object) method has successfully completed.

Specified by:
handleFault in interface EndpointInterceptor
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 response interceptor chain; false to indicate blocking of the response handler chain.
Throws:
Exception

afterCompletion

public void afterCompletion(MessageContext messageContext,
                            Object endpoint,
                            Exception ex)
                     throws Exception
Description copied from interface: EndpointInterceptor
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 EndpointInterceptor.handleRequest(org.springframework.ws.context.MessageContext, java.lang.Object) method has successfully completed.

As with the EndpointInterceptor.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.

Specified by:
afterCompletion in interface EndpointInterceptor
Parameters:
messageContext - contains both request and response messages, the response should contains a Fault
endpoint - chosen endpoint to invoke
ex - exception thrown on handler execution, if any
Throws:
Exception - in case of errors

Spring Web Services Framework

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