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 Node
s 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
-
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplate
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description XPathMessageSplitter(java.lang.String expression)
XPathMessageSplitter(java.lang.String expression, java.util.Map<java.lang.String,java.lang.String> namespaces)
XPathMessageSplitter(java.lang.String expression, java.util.Map<java.lang.String,java.lang.String> namespaces, javax.xml.transform.TransformerFactory transformerFactory)
Construct an instance based on the provided xpath expression, namespaces andTransformerFactory
.XPathMessageSplitter(java.lang.String expression, javax.xml.transform.TransformerFactory transformerFactory)
Construct an instance based on the provided xpath expression andTransformerFactory
.XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression)
XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression, javax.xml.transform.TransformerFactory transformerFactory)
Construct an instance based on the provided xpath expression andTransformerFactory
. -
Method Summary
Modifier and Type Method Description protected void
doInit()
java.lang.String
getComponentType()
protected int
obtainSizeIfPossible(java.util.Iterator<?> iterator)
void
setCreateDocuments(boolean createDocuments)
void
setDocumentBuilder(javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)
void
setIterator(boolean iterator)
Theiterator
mode:true
(default) to return anIterator
for splittingpayload
,false
to return aList
.void
setOutputProperties(java.util.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 java.lang.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, shouldSplitOutput, updateNotPropagatedHeaders
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe
Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, 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
-
Constructor Details
-
XPathMessageSplitter
public XPathMessageSplitter(java.lang.String expression) -
XPathMessageSplitter
public XPathMessageSplitter(java.lang.String expression, javax.xml.transform.TransformerFactory transformerFactory)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
public XPathMessageSplitter(java.lang.String expression, java.util.Map<java.lang.String,java.lang.String> namespaces) -
XPathMessageSplitter
public XPathMessageSplitter(java.lang.String expression, java.util.Map<java.lang.String,java.lang.String> namespaces, javax.xml.transform.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
public XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression) -
XPathMessageSplitter
public XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression, javax.xml.transform.TransformerFactory transformerFactory)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
public java.lang.String getComponentType()- Specified by:
getComponentType
in interfaceorg.springframework.integration.support.context.NamedComponent
- Overrides:
getComponentType
in classorg.springframework.integration.splitter.AbstractMessageSplitter
-
setDocumentBuilder
public void setDocumentBuilder(javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory) -
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
public void setOutputProperties(java.util.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
- theTransformer
output properties.- Since:
- 4.2
- See Also:
Transformer.setOutputProperties(Properties)
-
doInit
protected void doInit()- Overrides:
doInit
in classorg.springframework.integration.splitter.AbstractMessageSplitter
-
splitMessage
protected java.lang.Object splitMessage(org.springframework.messaging.Message<?> message)- Specified by:
splitMessage
in classorg.springframework.integration.splitter.AbstractMessageSplitter
-
obtainSizeIfPossible
protected int obtainSizeIfPossible(java.util.Iterator<?> iterator)- Overrides:
obtainSizeIfPossible
in classorg.springframework.integration.splitter.AbstractMessageSplitter
-