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<Message<?>>,Aware,BeanClassLoaderAware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,ApplicationContextAware,Ordered,ExpressionCapable,Orderable,MessageProducer,DiscardingMessageHandler,HeaderPropagationAware,IntegrationPattern,NamedComponent,IntegrationManagement,TrackableComponent,MessageHandler,reactor.core.CoreSubscriber<Message<?>>
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.- Author:
- Jonas Partner, Mark Fisher, Artem Bilan, Gary Russell, Christian Tzolov
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
AbstractReplyProducingMessageHandler.RequestHandlerNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionXPathMessageSplitter(String expression) 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 andTransformerFactory.XPathMessageSplitter(String expression, TransformerFactory transformerFactory) Construct an instance based on the provided xpath expression andTransformerFactory.XPathMessageSplitter(XPathExpression xpathExpression) XPathMessageSplitter(XPathExpression xpathExpression, TransformerFactory transformerFactory) Construct an instance based on the provided xpath expression andTransformerFactory. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoInit()Subclasses may implement this method to provide component type information.protected intobtainSizeIfPossible(Iterator<?> iterator) Obtain a size of the providedIterator.voidsetCreateDocuments(boolean createDocuments) voidsetDocumentBuilder(DocumentBuilderFactory documentBuilderFactory) voidsetIterator(boolean iterator) voidsetOutputProperties(Properties outputProperties) A set of output properties that will be used to override any of the same properties in affect for the transformation.voidsetXmlPayloadConverter(XmlPayloadConverter xmlPayloadConverter) protected ObjectsplitMessage(Message<?> message) Subclasses must override this method to split the received Message.Methods inherited from class org.springframework.integration.splitter.AbstractMessageSplitter
addHeaders, getDiscardChannel, getIntegrationPatternType, handleRequestMessage, obtainSizeIfPossible, produceOutput, setApplySequence, setDiscardChannel, setDiscardChannelName, shouldCopyRequestHeaders, willAddHeadersMethods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyMethods 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, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods 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, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscriber
currentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.messaging.MessageHandler
handleMessageMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
XPathMessageSplitter
-
XPathMessageSplitter
Construct an instance based on the provided xpath expression andTransformerFactory.- Parameters:
expression- the xpath expression for splitting.transformerFactory- theTransformerFactoryfor parsing and building documents.- Since:
- 4.3.19
-
XPathMessageSplitter
-
XPathMessageSplitter
public XPathMessageSplitter(String expression, Map<String, String> namespaces, TransformerFactory transformerFactory) Construct an instance based on the provided xpath expression, namespaces andTransformerFactory.- Parameters:
expression- the xpath expression for splitting.namespaces- the XML namespace for parsing.transformerFactory- theTransformerFactoryfor parsing and building documents.- Since:
- 4.3.19
-
XPathMessageSplitter
-
XPathMessageSplitter
Construct an instance based on the provided xpath expression andTransformerFactory.- Parameters:
xpathExpression- the xpath expression for splitting.transformerFactory- theTransformerFactoryfor parsing and building documents.- Since:
- 4.3.19
-
-
Method Details
-
setCreateDocuments
public void setCreateDocuments(boolean createDocuments) -
getComponentType
Description copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classAbstractMessageSplitter
-
setDocumentBuilder
-
setXmlPayloadConverter
-
setIterator
-
setOutputProperties
A set of output properties that will be used to override any of the same properties in affect for the transformation.- Parameters:
outputProperties- theTransformeroutput properties.- Since:
- 4.2
- See Also:
-
doInit
protected void doInit()- Overrides:
doInitin classAbstractMessageSplitter
-
splitMessage
Description copied from class:AbstractMessageSplitterSubclasses must override this method to split the received Message. The return value may be a Collection or Array. The individual elements may be Messages, but it is not necessary. If the elements are not Messages, each will be provided as the payload of a Message. It is also acceptable to return a single Object or Message. In that case, a single reply Message will be produced.- Specified by:
splitMessagein classAbstractMessageSplitter- Parameters:
message- The message.- Returns:
- The result of splitting the message.
-
obtainSizeIfPossible
Description copied from class:AbstractMessageSplitterObtain a size of the providedIterator. Default implementation returns0.- Overrides:
obtainSizeIfPossiblein classAbstractMessageSplitter- Parameters:
iterator- theIteratorto obtain the size- Returns:
- the size of the
Iterator
-