Hi,
I'm trying to do message tranformations based on examples from Stack
Overflow etc and I have something on 3.0.4 like
public MessageXMLDecodeOutInterceptor() {
super(Phase.PRE_STREAM);
}
public void handleMessage(Message message) {
try (OutputStream outStream = message.getContent(OutputStream.class);
CachedOutputStream cachedStream = new CachedOutputStream();) {
message.setContent(OutputStream.class, cachedStream);
message.put(Message.ENCODING, charset.name());
message.getInterceptorChain().doIntercept(message);
cachedStream.flush();
String origMessage = IOUtils.toString(cachedStream.getInputStream(),
charset);
String newMessage = // modify the message
IOUtils.write(header, outStream, charset);
IOUtils.write(newMessage, outStream, charset);
} catch (IOException e) {
logger.errorf("Could not transform message", e);
}
}
and it works until the message i large (~200k?), then suddenly the
origMessage is "". Are large messages somehow cached/handled differently?
Thanks in advance,
Nik
--
Nicklas Karlsson, +358 40 5062266
Vaakunatie 10 as 7, 20780 Kaarina