public class XPathMessageSplitter extends AbstractMessageSplitter
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
.AbstractReplyProducingMessageHandler.RequestHandler
IntegrationManagement.ManagementOverrides
messagingTemplate
EXPRESSION_PARSER, logger
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
XPathMessageSplitter(java.lang.String expression) |
XPathMessageSplitter(java.lang.String expression,
java.util.Map<java.lang.String,java.lang.String> namespaces) |
XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression) |
Modifier and Type | Method and Description |
---|---|
protected void |
doInit() |
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected int |
obtainSizeIfPossible(java.util.Iterator<?> iterator)
Obtain a size of the provided
Iterator . |
void |
setCreateDocuments(boolean createDocuments) |
void |
setDocumentBuilder(javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory) |
void |
setIterator(boolean iterator)
The
iterator mode: true (default) to return an Iterator
for splitting payload , false to return a List . |
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)
Subclasses must override this method to split the received Message.
|
addHeaders, handleRequestMessage, obtainSizeIfPossible, produceOutput, setApplySequence, shouldCopyRequestHeaders, willAddHeaders
doInvokeAdvisedRequestHandler, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldSplitOutput, updateNotPropagatedHeaders
configureMetrics, getActiveCount, getActiveCountLong, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMinDuration, getOrder, getOverrides, getStandardDeviationDuration, handleMessage, isCountsEnabled, isLoggingEnabled, isStatsEnabled, onComplete, onError, onNext, onSubscribe, registerMetricsCaptor, reset, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabled
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
public XPathMessageSplitter(java.lang.String expression)
public XPathMessageSplitter(java.lang.String expression, java.util.Map<java.lang.String,java.lang.String> namespaces)
public XPathMessageSplitter(org.springframework.xml.xpath.XPathExpression xpathExpression)
public void setCreateDocuments(boolean createDocuments)
public java.lang.String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessageSplitter
public void setDocumentBuilder(javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)
public void setXmlPayloadConverter(XmlPayloadConverter xmlPayloadConverter)
public void setIterator(boolean iterator)
iterator
mode: true
(default) to return an Iterator
for splitting payload
, false
to return a List
.iterator
- boolean
flag for iterator mode. Default to true
.public void setOutputProperties(java.util.Properties outputProperties)
outputProperties
- the Transformer
output properties.Transformer.setOutputProperties(Properties)
protected void doInit()
doInit
in class AbstractReplyProducingMessageHandler
protected java.lang.Object splitMessage(org.springframework.messaging.Message<?> message)
AbstractMessageSplitter
splitMessage
in class AbstractMessageSplitter
message
- The message.protected int obtainSizeIfPossible(java.util.Iterator<?> iterator)
AbstractMessageSplitter
Iterator
.
Default implementation returns 0
.obtainSizeIfPossible
in class AbstractMessageSplitter
iterator
- the Iterator
to obtain the sizeIterator