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 Node
s 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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
AbstractReplyProducingMessageHandler.RequestHandler
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
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
ConstructorDescriptionXPathMessageSplitter
(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 void
doInit()
Subclasses may implement this method to provide component type information.protected int
obtainSizeIfPossible
(Iterator<?> iterator) Obtain a size of the providedIterator
.void
setCreateDocuments
(boolean createDocuments) void
setDocumentBuilder
(DocumentBuilderFactory documentBuilderFactory) void
setIterator
(boolean iterator) 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
setXmlPayloadConverter
(XmlPayloadConverter xmlPayloadConverter) protected Object
splitMessage
(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, 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
-
XPathMessageSplitter
Construct an instance based on the provided xpath expression andTransformerFactory
.- Parameters:
expression
- the xpath expression for splitting.transformerFactory
- theTransformerFactory
for 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
- theTransformerFactory
for 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
- theTransformerFactory
for parsing and building documents.- Since:
- 4.3.19
-
-
Method Details
-
setCreateDocuments
public void setCreateDocuments(boolean createDocuments) -
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classAbstractMessageSplitter
-
setDocumentBuilder
-
setXmlPayloadConverter
-
setIterator
public void setIterator(boolean iterator) Theiterator
mode:true
(default) to return anIterator
for splittingpayload
,false
to return aList
.- Parameters:
iterator
-boolean
flag for iterator mode. Default totrue
.- Since:
- 4.2
-
setOutputProperties
A set of output properties that will be used to override any of the same properties in affect for the transformation.- Parameters:
outputProperties
- theTransformer
output properties.- Since:
- 4.2
- See Also:
-
doInit
protected void doInit()- Overrides:
doInit
in classAbstractMessageSplitter
-
splitMessage
Description copied from class:AbstractMessageSplitter
Subclasses 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:
splitMessage
in classAbstractMessageSplitter
- Parameters:
message
- The message.- Returns:
- The result of splitting the message.
-
obtainSizeIfPossible
Description copied from class:AbstractMessageSplitter
Obtain a size of the providedIterator
. Default implementation returns0
.- Overrides:
obtainSizeIfPossible
in classAbstractMessageSplitter
- Parameters:
iterator
- theIterator
to obtain the size- Returns:
- the size of the
Iterator
-