org.springframework.ws.endpoint
Class AbstractLoggingInterceptor

java.lang.Object
  extended by org.springframework.ws.endpoint.TransformerObjectSupport
      extended by org.springframework.ws.endpoint.AbstractLoggingInterceptor
All Implemented Interfaces:
EndpointInterceptor
Direct Known Subclasses:
PayloadLoggingInterceptor, SoapEnvelopeLoggingInterceptor

public abstract class AbstractLoggingInterceptor
extends TransformerObjectSupport
implements EndpointInterceptor

Abstract base class for EndpointInterceptor instances that log a part of a WebServiceMessage. By default, both request and response messages are logged, but this behaviour can be changed using the logRequest and logResponse properties.

Author:
Arjen Poutsma

Field Summary
 
Fields inherited from class org.springframework.ws.endpoint.TransformerObjectSupport
logger
 
Constructor Summary
AbstractLoggingInterceptor()
           
 
Method Summary
protected abstract  Source getSource(WebServiceMessage message)
          Abstract template method that returns the Source for the given WebServiceMessage.
 boolean handleRequest(MessageContext messageContext, Object endpoint)
          Logs the request message payload.
 boolean handleResponse(MessageContext messageContext, Object endpoint)
          Logs the response message payload.
protected  void logMessageSource(String logMessage, Source source)
           
 void setLogRequest(boolean logRequest)
          Indicates whether the request should be logged.
 void setLogResponse(boolean logResponse)
          Indicates whether the response should be logged.
 
Methods inherited from class org.springframework.ws.endpoint.TransformerObjectSupport
createTransformer, createTransformerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLoggingInterceptor

public AbstractLoggingInterceptor()
Method Detail

setLogRequest

public final void setLogRequest(boolean logRequest)
Indicates whether the request should be logged. Default is true.


setLogResponse

public final void setLogResponse(boolean logResponse)
Indicates whether the response should be logged. Default is true.


handleRequest

public final boolean handleRequest(MessageContext messageContext,
                                   Object endpoint)
                            throws TransformerException
Logs the request message payload. Logging only ocurs if logRequest is set to true, which is the default.

Specified by:
handleRequest in interface EndpointInterceptor
Parameters:
messageContext - the message context
endpoint - chosen endpoint to invoke
Returns:
true
Throws:
TransformerException - when the payload cannot be transformed to a string

handleResponse

public boolean handleResponse(MessageContext messageContext,
                              Object endpoint)
                       throws Exception
Logs the response message payload. Logging only ocurs if logResponse is set to true, which is the default.

Specified by:
handleResponse in interface EndpointInterceptor
Parameters:
messageContext - the message context
endpoint - chosen endpoint to invoke
Returns:
true
Throws:
TransformerException - when the payload cannot be transformed to a string
Exception

logMessageSource

protected void logMessageSource(String logMessage,
                                Source source)
                         throws TransformerException
Throws:
TransformerException

getSource

protected abstract Source getSource(WebServiceMessage message)
Abstract template method that returns the Source for the given WebServiceMessage.

Parameters:
message - the message
Returns:
the source of the message


Copyright (c) 2005-2006 The Spring Framework Project.