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_RESULTFields 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 ObjectdoTransform(Message<?> message)Subclasses must implement this method to provide the transformation logic.StringgetComponentType()Subclasses may implement this method to provide component type information.protected voidonInit()Subclasses may implement this for initialization logic.voidsetAlwaysUseResultFactory(boolean alwaysUseResultFactory)Specify whether to always use result factory even for directly supported payload typesvoidsetAlwaysUseSourceFactory(boolean alwaysUseSourceFactory)Specify whether to always use source factory even for directly supported payload types.voidsetBeanClassLoader(ClassLoader classLoader)voidsetResultFactory(ResultFactory resultFactory)Sets the ResultFactory.voidsetResultFactoryName(String resultFactoryName)voidsetResultType(String resultType)voidsetSourceFactory(SourceFactory sourceFactory)Sets the SourceFactory.voidsetXslParameterMappings(Map<String,Expression> xslParameterMappings)voidsetXsltParamHeaders(String... xsltParamHeaders)Methods inherited from class org.springframework.integration.xml.transformer.AbstractXmlTransformer
getResultFactory, getResultFactoryName, getResultTypeMethods inherited from class org.springframework.integration.transformer.AbstractTransformer
transformMethods 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:
setResultFactoryin 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:
setBeanClassLoaderin interfaceBeanClassLoaderAware
-
setResultType
- Overrides:
setResultTypein classAbstractXmlTransformer
-
setResultFactoryName
- Overrides:
setResultFactoryNamein classAbstractXmlTransformer
-
getComponentType
Description copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classIntegrationObjectSupport
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classAbstractXmlTransformer
-
doTransform
Description copied from class:AbstractTransformerSubclasses 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:
doTransformin classAbstractTransformer- Parameters:
message- The message.- Returns:
- The result of the transformation.
-