Class XmlSourceHandlerFactoryImpl

    • Constructor Detail

      • XmlSourceHandlerFactoryImpl

        public XmlSourceHandlerFactoryImpl()
    • Method Detail

      • isFailOnNullBody

        public boolean isFailOnNullBody()
        Returns true if we fail when the body is null.
      • setFailOnNullBody

        public void setFailOnNullBody​(boolean failOnNullBody)
        Set if we should fail when the body is null
      • getSource

        public Source getSource​(org.apache.camel.Exchange exchange)
                         throws Exception
        Description copied from interface: SourceHandlerFactory
        Creates a specific Source depending on the current message exchanged
        Specified by:
        getSource in interface SourceHandlerFactory
        Parameters:
        exchange - the exchange
        Returns:
        the source created from the message
        Throws:
        Exception - if the source couldn't be created
      • isInputStreamNeeded

        protected boolean isInputStreamNeeded​(org.apache.camel.Exchange exchange)
        Checks whether we need an InputStream to access the message body.

        Depending on the content in the message body, we may not need to convert to InputStream.

        Parameters:
        exchange - the current exchange
        Returns:
        true to convert to InputStream beforehand converting to Source afterwards.
      • getSource

        protected Source getSource​(org.apache.camel.Exchange exchange,
                                   Object body)
        Converts the inbound body to a Source, if the body is not already a Source.

        This implementation will prefer to source in the following order:

        • StAX - If StAX is allowed
        • SAX - SAX as 2nd choice
        • Stream - Stream as 3rd choice
        • DOM - DOM as 4th choice