@SupportsOutputStreaming public class XsltSender extends StreamingSenderBase implements IThreadCreator
Modifier and Type | Field and Description |
---|---|
boolean |
DEFAULT_INDENT |
boolean |
DEFAULT_OMIT_XML_DECLARATION |
TransformerPool.OutputType |
DEFAULT_OUTPUT_METHOD |
TransformerPool.OutputType |
DEFAULT_XPATH_OUTPUT_METHOD |
protected ThreadLifeCycleEventListener<Object> |
threadLifeCycleEventListener |
protected IThreadConnectableTransactionManager |
txManager |
parameterNamesMustBeUnique, paramList
log
Constructor and Description |
---|
XsltSender() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Stop/close the sender and deallocate resources.
|
void |
configure()
The
configure() method instantiates a transformer for the specified
XSL. |
protected ContentHandler |
createHandler(Message input,
ThreadConnector threadConnector,
PipeLineSession session,
TransformerPool poolToUse,
MessageOutputStream target) |
protected ContentHandler |
filterInput(ContentHandler input,
PipeLineSession session) |
protected TransformerPool |
getTransformerPoolToUse(PipeLineSession session) |
protected XMLReader |
getXmlReader(PipeLineSession session,
ContentHandler handler,
BiConsumer<AutoCloseable,String> closeOnCloseRegister) |
protected boolean |
isDisableOutputEscaping(TransformerPool poolToUse) |
boolean |
isSynchronous()
When
true , the result of sendMessage is the reply of the request. |
void |
open()
This method will be called to start the sender.
|
MessageOutputStream |
provideOutputStream(PipeLineSession session,
IForwardTarget next)
return a
MessageOutputStream that can be used to write a message to, that then will be processed in a streaming way. |
PipeRunResult |
sendMessage(Message message,
PipeLineSession session,
IForwardTarget next) |
void |
setDebugInput(boolean debugInput)
If set
true the input is written to the log file, at DEBUG level |
void |
setDisableOutputEscaping(Boolean b)
If set
true , any output is reparsed before being handled as XML again. |
void |
setHandleLexicalEvents(boolean b)
If set
true , the transformer is enabled to handle lexical events, allowing it for example to process comments and to distinghuish CDATA from escaped text. |
void |
setIndentXml(Boolean b)
If set
true , result is pretty-printed. |
void |
setNamespaceAware(boolean b)
Deprecated.
|
void |
setNamespaceDefs(String namespaceDefs)
Namespace defintions for xpathExpression.
|
void |
setOmitXmlDeclaration(Boolean b)
Omit the XML declaration on top of the output.
|
void |
setOutputType(TransformerPool.OutputType string)
For xpathExpression only
|
void |
setRemoveNamespaces(boolean b)
If set
true namespaces (and prefixes) in the input message are removed before transformation |
void |
setSkipEmptyTags(boolean b)
If set
true empty tags in the output are removed after transformation |
void |
setStreamingXslt(Boolean streamingActive)
If true, then this sender will process the XSLT while streaming in a different thread.
|
void |
setStyleSheetCacheSize(int size)
Size of cache of stylesheets retrieved from styleSheetNameSessionKey
|
void |
setStyleSheetName(String stylesheetName)
Location of stylesheet to apply to the input message
|
void |
setStyleSheetNameSessionKey(String newSessionKey)
Session key to retrieve stylesheet location.
|
void |
setXpathExpression(String string)
Alternatively: XPath-expression to create stylesheet from
|
void |
setXslt2(boolean b)
Deprecated.
Please remove setting of xslt2, it will be auto detected. Or use xsltVersion.
|
void |
setXsltVersion(int xsltVersion)
If set to
2 or 3 a Saxon (net.sf.saxon) xslt processor 2.0 or 3.0 respectively will be used, otherwise xslt processor 1.0 (org.apache.xalan). |
canProvideOutputStream, sendMessage, supportsOutputStreamPassThrough
addParameter, checkStringAttributeOrParameter, consumesSessionVariable, getParameterList, getParameterOverriddenAttributeValue, getParameterOverriddenAttributeValue, getParameterValueList
createBean, getLogPrefix, getName, setApplicationContext, setName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setThreadLifeCycleEventListener
consumesSessionVariable
sendMessageOrThrow
getName, setName
getApplicationContext, getName
getConfigurationClassLoader
setApplicationContext
addParameter, getParameterList
public final TransformerPool.OutputType DEFAULT_OUTPUT_METHOD
public final TransformerPool.OutputType DEFAULT_XPATH_OUTPUT_METHOD
public final boolean DEFAULT_INDENT
public final boolean DEFAULT_OMIT_XML_DECLARATION
protected ThreadLifeCycleEventListener<Object> threadLifeCycleEventListener
protected IThreadConnectableTransactionManager txManager
public void configure() throws ConfigurationException
configure()
method instantiates a transformer for the specified
XSL. If the stylesheetName cannot be accessed, a ConfigurationException is thrown.configure
in interface IConfigurable
configure
in interface ISender
configure
in class StreamingSenderBase
ConfigurationException
public void open() throws SenderException
ISender
sendMessage()
method.open
in interface ISender
open
in class SenderBase
SenderException
public void close() throws SenderException
ISender
close
in interface ISender
close
in class SenderBase
SenderException
protected ContentHandler filterInput(ContentHandler input, PipeLineSession session)
public MessageOutputStream provideOutputStream(PipeLineSession session, IForwardTarget next) throws StreamingException
IOutputStreamingSupport
MessageOutputStream
that can be used to write a message to, that then will be processed in a streaming way.
If a target MessageOutputStream is required to stream output to, this can be obtained from next
, if specified.
If the implementor of this method is a pipe, and it is the last one in the chain of streaming pipes, it must provide the appropriate
forward in the provide MessageOutputStream.
If the class cannot provide an outputstream, it must return null.
If the provider of an outputstream is a pipe itself, it must provide a proper pipeforward in the provided outputstreamprovideOutputStream
in interface IOutputStreamingSupport
StreamingException
protected boolean isDisableOutputEscaping(TransformerPool poolToUse) throws TransformerException, IOException, SAXException
protected TransformerPool getTransformerPoolToUse(PipeLineSession session) throws SenderException, IOException, ConfigurationException
protected ContentHandler createHandler(Message input, ThreadConnector threadConnector, PipeLineSession session, TransformerPool poolToUse, MessageOutputStream target) throws StreamingException
StreamingException
protected XMLReader getXmlReader(PipeLineSession session, ContentHandler handler, BiConsumer<AutoCloseable,String> closeOnCloseRegister) throws ParserConfigurationException, SAXException
public PipeRunResult sendMessage(Message message, PipeLineSession session, IForwardTarget next) throws SenderException
sendMessage
in interface IStreamingSender
SenderException
public void setStreamingXslt(Boolean streamingActive)
public boolean isSynchronous()
ISender
true
, the result of sendMessage is the reply of the request.isSynchronous
in interface ISender
isSynchronous
in class SenderBase
public void setStyleSheetName(String stylesheetName)
public void setStyleSheetNameSessionKey(String newSessionKey)
public void setStyleSheetCacheSize(int size)
public void setXpathExpression(String string)
public void setOmitXmlDeclaration(Boolean b)
public void setDisableOutputEscaping(Boolean b)
true
, any output is reparsed before being handled as XML again. If not set, the stylesheet is searched for @disable-output-escaping='yes'
and the value is set accordinglypublic void setNamespaceDefs(String namespaceDefs)
prefix=namespaceuri
-definitions. For some other use cases (NOT xpathExpression), one entry can be without a prefix, that will define the default namespace.
If left empty, an the xpathExpression will match any namespacepublic void setOutputType(TransformerPool.OutputType string)
public void setIndentXml(Boolean b)
true
, result is pretty-printed. If not set, the value specified in the stylesheet is followed@Deprecated @ConfigurationWarning(value="please use attribute \'removeNamespaces\' instead") public void setNamespaceAware(boolean b)
public void setRemoveNamespaces(boolean b)
true
namespaces (and prefixes) in the input message are removed before transformationpublic void setHandleLexicalEvents(boolean b)
true
, the transformer is enabled to handle lexical events, allowing it for example to process comments and to distinghuish CDATA from escaped text.
Beware that this option can cause spurious NullPointerExceptions due to a race condition in streaming XSLT 1.0 processing in Xalan 2.7.2public void setSkipEmptyTags(boolean b)
true
empty tags in the output are removed after transformationpublic void setXsltVersion(int xsltVersion)
2
or 3
a Saxon (net.sf.saxon) xslt processor 2.0 or 3.0 respectively will be used, otherwise xslt processor 1.0 (org.apache.xalan). 0
will auto detectpublic void setDebugInput(boolean debugInput)
true
the input is written to the log file, at DEBUG level@Deprecated @ConfigurationWarning(value="It\'s value is now auto detected. If necessary, replace with a setting of xsltVersion") public void setXslt2(boolean b)
Copyright © 2023 Frank!Framework. All rights reserved.