Class XsltSender

All Implemented Interfaces:
IConfigurable, IConfigurationAware, INamedObject, IScopeProvider, ISender, ISenderWithParameters, IWithParameters, IThreadCreator, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
JsonXsltSender

public class XsltSender extends SenderWithParametersBase implements IThreadCreator
Perform an XSLT transformation with a specified stylesheet or XPath-expression.
Since:
4.9
Author:
Gerrit van Brakel
Parameters
any parameters defined on the sender will be applied to the created transformer
  • Field Details

  • Constructor Details

    • XsltSender

      public XsltSender()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      The configure() method instantiates a transformer for the specified XSL. If the stylesheetName cannot be accessed, a ConfigurationException is thrown.
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface ISender
      Overrides:
      configure in class SenderWithParametersBase
      Throws:
      ConfigurationException
    • open

      public void open() throws SenderException
      Description copied from interface: ISender
      This method will be called to start the sender. After this method is called the sendMessage method may be called. Purpose of this method is to reduce creating connections to databases etc. in the sendMessage() method.
      Specified by:
      open in interface ISender
      Overrides:
      open in class SenderBase
      Throws:
      SenderException
    • close

      public void close() throws SenderException
      Description copied from interface: ISender
      Stop/close the sender and deallocate resources.
      Specified by:
      close in interface ISender
      Overrides:
      close in class SenderBase
      Throws:
      SenderException
    • filterInput

      protected ContentHandler filterInput(ContentHandler input, PipeLineSession session)
    • isDisableOutputEscaping

      protected boolean isDisableOutputEscaping(TransformerPool poolToUse) throws TransformerException, IOException
      Throws:
      TransformerException
      IOException
    • getTransformerPoolToUse

      protected TransformerPool getTransformerPoolToUse(PipeLineSession session) throws SenderException, ConfigurationException
      Throws:
      SenderException
      ConfigurationException
    • createHandler

      protected ContentHandler createHandler(Message input, ThreadConnector threadConnector, PipeLineSession session, TransformerPool poolToUse, ContentHandler handler, File tempFile) throws StreamingException
      Throws:
      StreamingException
    • getXmlReader

      protected XMLReader getXmlReader(PipeLineSession session, ContentHandler handler) throws ParserConfigurationException, SAXException
      Throws:
      ParserConfigurationException
      SAXException
    • sendMessage

      public SenderResult sendMessage(Message message, PipeLineSession session) throws SenderException
      alternative implementation of send message, that should do the same as the original, but reuses the streaming content handler
      Specified by:
      sendMessage in interface ISender
      Throws:
      SenderException
    • setStreamingXslt

      public void setStreamingXslt(Boolean streamingActive)
      If true, then this sender will process the XSLT while streaming in a different thread. Can be used to switch streaming off for debugging purposes
      Default value
      set by appconstant xslt.streaming.default
    • setStyleSheetName

      public void setStyleSheetName(String stylesheetName)
      Location of stylesheet to apply to the input message
    • setStyleSheetNameSessionKey

      public void setStyleSheetNameSessionKey(String newSessionKey)
      Session key to retrieve stylesheet location. Overrides stylesheetName or xpathExpression attribute
    • setStyleSheetCacheSize

      public void setStyleSheetCacheSize(int size)
      Size of cache of stylesheets retrieved from styleSheetNameSessionKey
      Default value
      100
    • setXpathExpression

      public void setXpathExpression(String string)
      Alternatively: XPath-expression to create stylesheet from
    • setOmitXmlDeclaration

      public void setOmitXmlDeclaration(Boolean b)
      Omit the XML declaration on top of the output. If not set, the value specified in the stylesheet is followed
      Default value
      false, if not set in stylesheet
    • setDisableOutputEscaping

      public void setDisableOutputEscaping(Boolean b)
      If set 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 accordingly
      Default value
      false, if not set in stylesheet
    • setNamespaceDefs

      public void setNamespaceDefs(String namespaceDefs)
      Namespace defintions for xpathExpression. Must be in the form of a comma or space separated list of 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 namespace
    • setOutputType

      public void setOutputType(TransformerPool.OutputType string)
      For xpathExpression only
      Default value
      text
    • setIndentXml

      public void setIndentXml(Boolean b)
      If set true, result is pretty-printed. If not set, the value specified in the stylesheet is followed
      Default value
      false, if not set in stylesheet
    • setRemoveNamespaces

      public void setRemoveNamespaces(boolean b)
      If set true namespaces (and prefixes) in the input message are removed before transformation
      Default value
      false
    • setHandleLexicalEvents

      public 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. Beware that this option can cause spurious NullPointerExceptions due to a race condition in streaming XSLT 1.0 processing in Xalan 2.7.2
      Default value
      false
    • setSkipEmptyTags

      public void setSkipEmptyTags(boolean b)
      If set true empty tags in the output are removed after transformation
      Default value
      false
    • setXsltVersion

      public 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). 0 will auto-detect
      Default value
      0
    • setDebugInput

      public void setDebugInput(boolean debugInput)
      If set true the input is written to the log file, at DEBUG level
      Default value
      false
    • getStyleSheetName

      public String getStyleSheetName()
    • getStyleSheetNameSessionKey

      public String getStyleSheetNameSessionKey()
    • getXpathExpression

      public String getXpathExpression()
    • getNamespaceDefs

      public String getNamespaceDefs()
    • getOutputType

      public TransformerPool.OutputType getOutputType()
    • getOmitXmlDeclaration

      public Boolean getOmitXmlDeclaration()
    • getIndentXml

      public Boolean getIndentXml()
    • getDisableOutputEscaping

      public Boolean getDisableOutputEscaping()
    • isHandleLexicalEvents

      public boolean isHandleLexicalEvents()
    • isRemoveNamespaces

      public boolean isRemoveNamespaces()
    • isSkipEmptyTags

      public boolean isSkipEmptyTags()
    • getXsltVersion

      public int getXsltVersion()
    • isDebugInput

      public boolean isDebugInput()
    • setThreadLifeCycleEventListener

      public void setThreadLifeCycleEventListener(ThreadLifeCycleEventListener<Object> threadLifeCycleEventListener)
      Specified by:
      setThreadLifeCycleEventListener in interface IThreadCreator
    • setTxManager

      public void setTxManager(IThreadConnectableTransactionManager txManager)
    • getStreamingXslt

      public Boolean getStreamingXslt()