Check this: http://stackoverflow.com/questions/6915428/how-to-modify-the-raw-xml-message-of-an-outbound-cxf-request The second answer (the one from user snowindy) has an abstract class you could extend. I guess that's the example you're looking for.
On Thu, Jun 12, 2014 at 7:23 AM, Andrei Shakirin <[email protected]> wrote: > Hi, > > I think you need to insert your interceptor on Phase.PRE_STREAM phase and > replace OutputStream (XMLStreamWriter, Writer) with own one providing > search and replace logic: > OutputStream out = message.getContent(OutputStream.class); > CachedOutputStream wrapper = new CachedOutputStream(); > CachedOutputStreamCallback callback = new > OwnCustomOutputStream(out); > message.setContent(OutputStream.class, wrapper); > > As a sample your can take XSLTOutInterceptor, providing XSLT > transformation of outgoing messages: > > https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob;f=core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java;h=3a12c3cda190e7541a86de0b32f4c1eb86d26a7a;hb=master > > Regards, > Andrei. > > > > -----Original Message----- > > From: gquintana [mailto:[email protected]] > > Sent: Mittwoch, 11. Juni 2014 22:00 > > To: [email protected] > > Subject: Custom Interceptor > > > > Hello, > > > > I'd like to do search'n'replace on outgoing HTTP requests. I am trying > to do this > > with an Interceptor. I managed to bind my own Interceptor to the > PRE_STREAM > > phase, but then I am stuck at replacing message content. I've studied the > > LoggingOutInterceptor but it's too complicated and I don't get how it > works. > > > > Is there a simpler piece of code which I could take as an example? Are > > Interceptors the right tool for the Job? > > > > Using CXF 2.6.6 > > > > Thanx for your help, > > Gérald > > > > > > > > -- > > View this message in context: http://cxf.547215.n5.nabble.com/Custom- > > Interceptor-tp5745022.html > > Sent from the cxf-user mailing list archive at Nabble.com. >
