Class XPathMessageSplitter

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.splitter.AbstractMessageSplitter
org.springframework.integration.xml.splitter.XPathMessageSplitter
All Implemented Interfaces:
org.reactivestreams.Subscriber<org.springframework.messaging.Message<?>>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.context.Orderable, org.springframework.integration.core.MessageProducer, org.springframework.integration.handler.DiscardingMessageHandler, org.springframework.integration.handler.HeaderPropagationAware, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationManagement, org.springframework.integration.support.management.TrackableComponent, org.springframework.messaging.MessageHandler, reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>

public class XPathMessageSplitter extends org.springframework.integration.splitter.AbstractMessageSplitter
Message Splitter that uses an XPathExpression to split a Document, File or String payload into a NodeList. The return value will be either Strings or Nodes depending on the received payload type. Additionally, node types will be converted to Documents if the 'createDocuments' property is set to true.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler

    org.springframework.integration.handler.AbstractReplyProducingMessageHandler.RequestHandler

    Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement

    org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
  • Field Summary

    Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler

    messagingTemplate

    Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement

    METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    XPathMessageSplitter(String expression, Map<String,String> namespaces)
     
    XPathMessageSplitter(String expression, Map<String,String> namespaces, TransformerFactory transformerFactory)
    Construct an instance based on the provided xpath expression, namespaces and TransformerFactory.
    XPathMessageSplitter(String expression, TransformerFactory transformerFactory)
    Construct an instance based on the provided xpath expression and TransformerFactory.
    XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression)
     
    XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression, TransformerFactory transformerFactory)
    Construct an instance based on the provided xpath expression and TransformerFactory.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
     
    protected int
     
    void
    setCreateDocuments(boolean createDocuments)
     
    void
     
    void
    setIterator(boolean iterator)
    The iterator mode: true (default) to return an Iterator for splitting payload, false to return a List.
    void
    setOutputProperties(Properties outputProperties)
    A set of output properties that will be used to override any of the same properties in affect for the transformation.
    void
     
    protected Object
    splitMessage(org.springframework.messaging.Message<?> message)
     

    Methods inherited from class org.springframework.integration.splitter.AbstractMessageSplitter

    addHeaders, getDiscardChannel, getIntegrationPatternType, handleRequestMessage, obtainSizeIfPossible, produceOutput, setApplySequence, setDiscardChannel, setDiscardChannelName, shouldCopyRequestHeaders, willAddHeaders

    Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler

    doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply

    Methods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler

    addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldSplitOutput, updateNotPropagatedHeaders

    Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler

    handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConvention

    Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport

    buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack

    Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport

    afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface reactor.core.CoreSubscriber

    currentContext

    Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement

    getThisAs

    Methods inherited from interface org.springframework.messaging.MessageHandler

    handleMessage

    Methods inherited from interface org.springframework.integration.support.context.NamedComponent

    getBeanName, getComponentName
  • Constructor Details

    • XPathMessageSplitter

      public XPathMessageSplitter(String expression)
    • XPathMessageSplitter

      public XPathMessageSplitter(String expression, TransformerFactory transformerFactory)
      Construct an instance based on the provided xpath expression and TransformerFactory.
      Parameters:
      expression - the xpath expression for splitting.
      transformerFactory - the TransformerFactory for parsing and building documents.
      Since:
      4.3.19
    • XPathMessageSplitter

      public XPathMessageSplitter(String expression, Map<String,String> namespaces)
    • XPathMessageSplitter

      public XPathMessageSplitter(String expression, Map<String,String> namespaces, TransformerFactory transformerFactory)
      Construct an instance based on the provided xpath expression, namespaces and TransformerFactory.
      Parameters:
      expression - the xpath expression for splitting.
      namespaces - the XML namespace for parsing.
      transformerFactory - the TransformerFactory for parsing and building documents.
      Since:
      4.3.19
    • XPathMessageSplitter

      public XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression)
    • XPathMessageSplitter

      public XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression, TransformerFactory transformerFactory)
      Construct an instance based on the provided xpath expression and TransformerFactory.
      Parameters:
      xpathExpression - the xpath expression for splitting.
      transformerFactory - the TransformerFactory for parsing and building documents.
      Since:
      4.3.19
  • Method Details

    • setCreateDocuments

      public void setCreateDocuments(boolean createDocuments)
    • getComponentType

      public String getComponentType()
      Specified by:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.splitter.AbstractMessageSplitter
    • setDocumentBuilder

      public void setDocumentBuilder(DocumentBuilderFactory documentBuilderFactory)
    • setXmlPayloadConverter

      public void setXmlPayloadConverter(XmlPayloadConverter xmlPayloadConverter)
    • setIterator

      public void setIterator(boolean iterator)
      The iterator mode: true (default) to return an Iterator for splitting payload, false to return a List.
      Parameters:
      iterator - boolean flag for iterator mode. Default to true.
      Since:
      4.2
    • setOutputProperties

      public void setOutputProperties(Properties outputProperties)
      A set of output properties that will be used to override any of the same properties in affect for the transformation.
      Parameters:
      outputProperties - the Transformer output properties.
      Since:
      4.2
      See Also:
    • doInit

      protected void doInit()
      Overrides:
      doInit in class org.springframework.integration.splitter.AbstractMessageSplitter
    • splitMessage

      protected Object splitMessage(org.springframework.messaging.Message<?> message)
      Specified by:
      splitMessage in class org.springframework.integration.splitter.AbstractMessageSplitter
    • obtainSizeIfPossible

      protected int obtainSizeIfPossible(Iterator<?> iterator)
      Overrides:
      obtainSizeIfPossible in class org.springframework.integration.splitter.AbstractMessageSplitter