Class XsltPayloadTransformer
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.xml.transformer.AbstractXmlTransformer
org.springframework.integration.xml.transformer.XsltPayloadTransformer
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,BeanNameAware
,InitializingBean
,ApplicationContextAware
,ExpressionCapable
,NamedComponent
,GenericTransformer<Message<?>,Message<?>>
,Transformer
public class XsltPayloadTransformer extends AbstractXmlTransformer implements BeanClassLoaderAware
Thread safe XSLT transformer implementation which returns a transformed
Source
, Document
, or String
. If
alwaysUseSourceResultFactories is false (default) the following logic occurs
String
payload in results in String
payload out
Document
payload in results in Document
payload out
Source
payload in results in Result
payload out, type will be
determined by the ResultFactory
,
DomResultFactory
by default.
If an instance of ResultTransformer
is registered this will be used
to convert the result.
If alwaysUseSourceResultFactories is true then the ResultFactory and
SourceFactory
will be used to create the Source
from the
payload and the Result
to pass into the transformer. An instance of
ResultTransformer
can also be provided to convert the Result prior to
returning.
- Author:
- Jonas Partner, Mark Fisher, Oleg Zhurakousky, Artem Bilan, Mike Bazos, Gary Russell
-
Field Summary
Fields inherited from class org.springframework.integration.xml.transformer.AbstractXmlTransformer
DOM_RESULT, STRING_RESULT
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description XsltPayloadTransformer(Templates templates)
XsltPayloadTransformer(Templates templates, ResultTransformer resultTransformer)
XsltPayloadTransformer(Resource xslResource)
XsltPayloadTransformer(Resource xslResource, String transformerFactoryClassName)
XsltPayloadTransformer(Resource xslResource, ResultTransformer resultTransformer)
XsltPayloadTransformer(Resource xslResource, ResultTransformer resultTransformer, String transformerFactoryClassName)
-
Method Summary
Modifier and Type Method Description protected Object
doTransform(Message<?> message)
Subclasses must implement this method to provide the transformation logic.String
getComponentType()
Subclasses may implement this method to provide component type information.protected void
onInit()
Subclasses may implement this for initialization logic.void
setAlwaysUseResultFactory(boolean alwaysUseResultFactory)
Specify whether to always use result factory even for directly supported payload typesvoid
setAlwaysUseSourceFactory(boolean alwaysUseSourceFactory)
Specify whether to always use source factory even for directly supported payload types.void
setBeanClassLoader(ClassLoader classLoader)
void
setResultFactory(ResultFactory resultFactory)
Sets the ResultFactory.void
setResultFactoryName(String resultFactoryName)
void
setResultType(String resultType)
void
setSourceFactory(SourceFactory sourceFactory)
Sets the SourceFactory.void
setXslParameterMappings(Map<String,Expression> xslParameterMappings)
void
setXsltParamHeaders(String... xsltParamHeaders)
Methods inherited from class org.springframework.integration.xml.transformer.AbstractXmlTransformer
getResultFactory, getResultFactoryName, getResultType
Methods inherited from class org.springframework.integration.transformer.AbstractTransformer
transform
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
-
Constructor Details
-
XsltPayloadTransformer
-
XsltPayloadTransformer
-
XsltPayloadTransformer
-
XsltPayloadTransformer
-
XsltPayloadTransformer
-
XsltPayloadTransformer
public XsltPayloadTransformer(Resource xslResource, ResultTransformer resultTransformer, String transformerFactoryClassName)
-
-
Method Details
-
setSourceFactory
Sets the SourceFactory.- Parameters:
sourceFactory
- The source factory.
-
setResultFactory
Sets the ResultFactory.- Overrides:
setResultFactory
in classAbstractXmlTransformer
- Parameters:
resultFactory
- The result factory.
-
setAlwaysUseSourceFactory
public void setAlwaysUseSourceFactory(boolean alwaysUseSourceFactory)Specify whether to always use source factory even for directly supported payload types.- Parameters:
alwaysUseSourceFactory
- true to always use the source factory.
-
setAlwaysUseResultFactory
public void setAlwaysUseResultFactory(boolean alwaysUseResultFactory)Specify whether to always use result factory even for directly supported payload types- Parameters:
alwaysUseResultFactory
- true to always use the result factory.
-
setXslParameterMappings
-
setXsltParamHeaders
-
setBeanClassLoader
- Specified by:
setBeanClassLoader
in interfaceBeanClassLoaderAware
-
setResultType
- Overrides:
setResultType
in classAbstractXmlTransformer
-
setResultFactoryName
- Overrides:
setResultFactoryName
in classAbstractXmlTransformer
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classIntegrationObjectSupport
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classAbstractXmlTransformer
-
doTransform
Description copied from class:AbstractTransformer
Subclasses must implement this method to provide the transformation logic. If the return value is itself a Message, it will be used as the result. Otherwise, any non-null return value will be used as the payload of the result Message.- Specified by:
doTransform
in classAbstractTransformer
- Parameters:
message
- The message.- Returns:
- The result of the transformation.
-