This commit is contained in:
Arjen Poutsma
2008-03-19 20:52:53 +00:00
parent 7497061e25
commit a7b29fc683

View File

@@ -17,37 +17,67 @@
package org.springframework.ws.client.support.interceptor;
import org.springframework.ws.client.WebServiceClientException;
import org.springframework.ws.client.core.WebServiceMessageCallback;
import org.springframework.ws.client.core.WebServiceTemplate;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.soap.SoapHeader;
import org.springframework.ws.transport.WebServiceConnection;
/**
* Workflow interface that allows for customized client-side message interception. Applications can register any number
* of existing or custom interceptors on a {@link WebServiceTemplate}, to add common pre- and postprocessing behavior
* without needing to modify payload handling code.
* of existing or custom interceptors on a {@link org.springframework.ws.client.core.WebServiceTemplate}, to add common
* pre- and postprocessing behavior without needing to modify payload handling code.
* <p/>
* A <code>ClientInterceptor</code> gets called after payload creation (using {@link
* WebServiceTemplate#marshalSendAndReceive(Object)} or similar methods, and after {@link WebServiceMessageCallback
* callback} invocation, but before the message is sent over the {@link WebServiceConnection}. 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 meta-data (i.e. {@link SoapHeader}) related code.
* org.springframework.ws.client.core.WebServiceTemplate#marshalSendAndReceive(Object)} or similar methods, and after
* {@link org.springframework.ws.client.core.WebServiceMessageCallback callback} invocation, but before the message is
* sent over the {@link WebServiceConnection}. 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 meta-data
* (i.e. {@link SoapHeader}) related code.
* <p/>
* Client interceptors are defined on a {@link WebServiceTemplate}, using the {@link
* WebServiceTemplate#setInterceptors(ClientInterceptor[]) interceptors} property.
* Client interceptors are defined on a {@link org.springframework.ws.client.core.WebServiceTemplate}, using the {@link
* org.springframework.ws.client.core.WebServiceTemplate#setInterceptors(ClientInterceptor[]) interceptors} property.
*
* @author Giovanni Cuccu
* @author Arjen Poutsma
* @see WebServiceTemplate#setInterceptors(ClientInterceptor[])
* @see org.springframework.ws.client.core.WebServiceTemplate#setInterceptors(ClientInterceptor[])
* @since 1.5.0
*/
public interface ClientInterceptor {
/**
* Processes the outgoing request message. Called after payload creation and callback invocation, but before the
* message is sent.
*
* @param messageContext contains the outgoing request message
* @return <code>true</code> to continue processing of the request interceptors; <code>false</code> to indicate
* blocking of the request endpoint chain
* @throws WebServiceClientException in case of errors
* @see MessageContext#getRequest()
*/
boolean handleRequest(MessageContext messageContext) throws WebServiceClientException;
/**
* Processes the incoming response message. Called for non-fault response messages before payload handling in the
* {@link org.springframework.ws.client.core.WebServiceTemplate}.
*
* @param messageContext contains the outgoing request message
* @return <code>true</code> to continue processing of the request interceptors; <code>false</code> to indicate
* blocking of the response endpoint chain
* @throws WebServiceClientException in case of errors
* @see MessageContext#getResponse()
*/
boolean handleResponse(MessageContext messageContext) throws WebServiceClientException;
/**
* Processes the incoming response fault. Called for response fault messages before payload handling in the {@link
* org.springframework.ws.client.core.WebServiceTemplate}.
*
* @param messageContext contains the outgoing request message
* @return <code>true</code> to continue processing of the request interceptors; <code>false</code> to indicate
* blocking of the request endpoint chain
* @throws WebServiceClientException in case of errors
* @see MessageContext#getResponse()
* @see org.springframework.ws.FaultAwareWebServiceMessage#hasFault()
*/
boolean handleFault(MessageContext messageContext) throws WebServiceClientException;
}