You have a couple options:

Stream level:
Put an interceptor in the PRE_STREAM phase that grabs the OutputStream from the message and wrappers it with a "fixing" output stream. You would need to have it set:
addAfter(AttachmentOutInterceptor.class.getName());
addBefore(StaxOutInterceptor.class.getName());
to make sure it gets in the correct spot.

Stax level:
Write a wrapper XMLStreamWriter that delegates all the calls to the original XMLStreamWriter except for the writeCharacters calls that get fixed up first. (StaxUtils has a StreamWriterDelegate that you can use as a baseclass that does all the delegation. Just override the methods). Create an intercept put in PRE_STREAM, but
addAfter(StaxOutInterceptor.class.getName());
that replaces the stream writer with your delegate. It would also need to do: message .put (AbstractOutDatabindingInterceptor.DISABLE_OUTPUTSTREAM_OPTIMIZATION,
                  Boolean.TRUE);
to disable an optization we do to re-drop to the streams when possible.


Dan



On Jun 20, 2008, at 6:39 AM, splatch wrote:


Hello dear CXF users and developers. :)

I have problem with CXF based web service. That isn't library issue but i need help to resolve it. Web service implementation rads some data from database, map it to objects and return. There is problem because readed data contains 0x0 characters and bad encoding (Mazovia). I would like to convert bad characters/bytes using interceptors but i don't know what Phase would be correct (MARSHAL, POST_MARSHAL?) and i don't know how to replace/ modify CXF
generated content.

Is there any ideas? I would like to use stream and bytes because it will be
much faster than Reflection.

Regars,
Luke
--
View this message in context: 
http://www.nabble.com/CXF-output-stream-modification-tp18026498p18026498.html
Sent from the cxf-user mailing list archive at Nabble.com.


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




Reply via email to