SWS-951 - Introduce ClientInterceptorAdapter

This commit introduces a ClientInterceptorAdapter with a default implementation
of the methods and providing a protected Log instance for subclasses. This convenience
class allows for pre-/post only ClientInterceptor instances without having to
add empty methods to it.
This commit is contained in:
Marten Deinum
2016-03-14 14:33:47 +01:00
parent 420e795607
commit b02a8bed99

View File

@@ -0,0 +1,43 @@
package org.springframework.ws.client.support.interceptor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ws.client.WebServiceClientException;
import org.springframework.ws.context.MessageContext;
/**
*
* Default implementation of the {@code ClientInterceptor} interface, for simplified implementation of
* pre-only/post-only interceptors.
*
* @author Marten Deinum
* @since 2.2.5
*/
public abstract class ClientInterceptorAdapter implements ClientInterceptor {
/** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass());
@Override
public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException {
return true;
}
@Override
public boolean handleResponse(MessageContext messageContext) throws WebServiceClientException {
return true;
}
@Override
public boolean handleFault(MessageContext messageContext) throws WebServiceClientException {
return true;
}
/**
* Does nothing by default.
*/
@Override
public void afterCompletion(MessageContext messageContext, Exception ex) throws WebServiceClientException {
}
}