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
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
XPathMessageSplitter(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 and
TransformerFactory . |
XPathMessageSplitter(String expression,
TransformerFactory transformerFactory)
Construct an instance based on the provided xpath expression and
TransformerFactory . |
XPathMessageSplitter(XPathExpression xpathExpression) |
XPathMessageSplitter(XPathExpression xpathExpression,
TransformerFactory transformerFactory)
Construct an instance based on the provided xpath expression and
TransformerFactory . |
Modifier and Type | Method and Description |
---|---|
protected void |
doInit() |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected int |
obtainSizeIfPossible(Iterator<?> iterator)
Obtain a size of the provided
Iterator . |
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.
|
addHeaders, getDiscardChannel, getIntegrationPatternType, handleRequestMessage, obtainSizeIfPossible, produceOutput, setApplySequence, setDiscardChannel, setDiscardChannelName, shouldCopyRequestHeaders, willAddHeaders
doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldSplitOutput, updateNotPropagatedHeaders
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
handleMessage
getThisAs
getBeanName, getComponentName
public XPathMessageSplitter(String expression)
public XPathMessageSplitter(String expression, TransformerFactory transformerFactory)
TransformerFactory
.expression
- the xpath expression for splitting.transformerFactory
- the TransformerFactory
for parsing and building documents.public XPathMessageSplitter(String expression, Map<String,String> namespaces, TransformerFactory transformerFactory)
TransformerFactory
.expression
- the xpath expression for splitting.namespaces
- the XML namespace for parsing.transformerFactory
- the TransformerFactory
for parsing and building documents.public XPathMessageSplitter(XPathExpression xpathExpression)
public XPathMessageSplitter(XPathExpression xpathExpression, TransformerFactory transformerFactory)
TransformerFactory
.xpathExpression
- the xpath expression for splitting.transformerFactory
- the TransformerFactory
for parsing and building documents.public void setCreateDocuments(boolean createDocuments)
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessageSplitter
public void setDocumentBuilder(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(Properties outputProperties)
outputProperties
- the Transformer
output properties.Transformer.setOutputProperties(Properties)
protected void doInit()
doInit
in class AbstractMessageSplitter
protected Object splitMessage(Message<?> message)
AbstractMessageSplitter
splitMessage
in class AbstractMessageSplitter
message
- The message.protected int obtainSizeIfPossible(Iterator<?> iterator)
AbstractMessageSplitter
Iterator
.
Default implementation returns 0
.obtainSizeIfPossible
in class AbstractMessageSplitter
iterator
- the Iterator
to obtain the sizeIterator