> -----Original Message-----
> From: Daniel Kulp [mailto:[email protected]]
> Sent: Wednesday, November 03, 2010 7:55 PM
> To: [email protected]
> Cc: KARR, DAVID (ATTSI)
> Subject: Re: Best way to get XML string in interceptor
> 
> On Wednesday 03 November 2010 7:28:24 pm KARR, DAVID (ATTSI) wrote:
> > > -----Original Message-----
> > > From: KARR, DAVID (ATTSI)
> > > Sent: Wednesday, November 03, 2010 2:33 PM
> > > To: [email protected]
> > > Subject: Best way to get XML string in interceptor
> > >
> > > I need to write some in/out interceptors that do something with
the
> > > incoming or outgoing XML string, but not modifying it for
> downstream
> > > interceptors or the eventual handler.  They are basically logging
> > > interceptors, like the LoggingOutInterceptor.
> > >
> > > How can I write a custom interceptor that can read the XML string,
> but
> > > still let the handler process it normally?
> > >
> > > It seems like subclassing LoggingOutInterceptor might work, and
> >
> > perhaps
> >
> > > setting the "writer" just before calling the
> "super.handleMessage()"
> > > method.  I tried this, but the writer ended up with an empty
> string.
> >
> > I can see why I ended up with an empty string.
LoggingOutInterceptor
> > writes the output asynchronously, so the writer doesn't get the data
> > until sometimes after the function returns.  I wish I could plug my
> own
> > callback into LoggingOutInterceptor, so I could implement
> > application-specific handling.  As it is, I guess I'm going to have
> to
> > duplicate most of what LoggingOutInterceptor is doing.
> 
> Well, if you write an interceptor that lives immediately after the
> LoggingOutInterceptor, you should be able to grab the Outputstream,
> cast it to
> the CacheAndWriteOutputStream, add your callback.

By "grab the Outputstream", do you mean just doing the same thing LOI is
doing:

        final OutputStream os = message.getContent(OutputStream.class);

Then casting that to CAWOS and registering a LoggingCallback which does
my logging work?

Can I do this in two separate interceptors that both run after the LOI?

Reply via email to