use of nl.nn.adapterframework.stream.xml.XmlTap in project iaf by ibissource.
the class XsltSender method sendMessage.
/*
* alternative implementation of send message, that should do the same as the original, but reuses the streaming content handler
*/
@Override
public PipeRunResult sendMessage(Message message, PipeLineSession session, IForwardTarget next) throws SenderException {
if (message == null) {
throw new SenderException(getLogPrefix() + "got null input");
}
try {
try (ThreadConnector threadConnector = streamingXslt ? new ThreadConnector(this, threadLifeCycleEventListener, txManager, session) : null) {
try (MessageOutputStream target = MessageOutputStream.getTargetStream(this, session, next)) {
ContentHandler handler = createHandler(message, threadConnector, session, target);
if (isDebugInput() && log.isDebugEnabled()) {
handler = new XmlTap(handler) {
@Override
public void endDocument() throws SAXException {
super.endDocument();
log.debug(getLogPrefix() + " xml input [" + getWriter() + "]");
}
};
}
XMLReader reader = getXmlReader(session, handler);
InputSource source = message.asInputSource();
reader.parse(source);
return target.getPipeRunResult();
}
}
} catch (Exception e) {
throw new SenderException(getLogPrefix() + "Exception on transforming input", e);
}
}
Aggregations