On Friday 24 October 2008 6:38:30 pm Benson Margulies wrote:
> Actually, I'd prefer if you change the interceptor to have a protected
> function that does nothing. Thus, the pattern will be to make a
> subclass that overrides the function instead of passing in a filtering
> function. This seems somehow more consistent with everything else.

I agree.   A simple protected method to handle this is preferred.

Dan


> On Fri, Oct 24, 2008 at 5:06 PM, Santosh Kulkarni <[EMAIL PROTECTED]> 
wrote:
> > Hi,
> >
> >   I wanted to do some custom logging of the outgoing message. The
> > suggestion was to look into the class LoggingOutInterceptor. I made it
> > work but only with copy-paste-change.
> >
> >
> >
> > How about we make a small change to the LoggingOutInterceptor making it
> > accept another argument in the constructor of type LogMessageTransformer,
> > which it can call prior to actually writing to the log. This will help in
> > case we just need to make some search and replace like changes, e.g.
> > masking sensitive information with X's.
> >
> >
> >
> > Interface and modification is as follows.
> >
> > //Interface
> >
> > public interface LogMessageTransformer {
> >
> >       /**
> >
> >        * @param argMessageToBeTransformed incoming message to be
> > transformed
> >
> >        * @return transformedMessage
> >
> >        */
> >
> >       public String transform(String argMessageToBeTransformed);
> >
> > }
> >
> > //change to the LoggingOutInterceptor.java
> >
> > String logMessage=buffer.toString() ;
> >
> > If(transformer!=null){
> >
> >         logMessage=transformer.transform(logMessage);
> >
> > }
> >
> > if (writer != null) {
> >
> >         writer.println(logMessage);
> >
> >                  } else if (LOG.isLoggable(Level.INFO)) {
> >
> >                      LOG.info(logMessage);
> >
> >                  }
> >
> >
> >
> > The information transmitted is intended only for the person or entity to
> > which it is addressed and may contain confidential and/or privileged
> > material.  If the reader of this message is not the intended recipient,
> > you are hereby notified that your access is unauthorized, and any review,
> > dissemination, distribution or copying of this message including any
> > attachments is strictly prohibited.   If you are not the intended
> > recipient, please contact the sender and delete the material from any
> > computer.



-- 
Daniel Kulp
[EMAIL PROTECTED]
http://dankulp.com/blog

Reply via email to