org.springframework.integration.xml.transformer
Class XsltPayloadTransformer

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.transformer.AbstractTransformer
          extended by org.springframework.integration.xml.transformer.XsltPayloadTransformer
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.integration.context.NamedComponent, org.springframework.integration.transformer.Transformer

public class XsltPayloadTransformer
extends org.springframework.integration.transformer.AbstractTransformer

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.


Constructor Summary
XsltPayloadTransformer(org.springframework.core.io.Resource xslResource)
           
XsltPayloadTransformer(org.springframework.core.io.Resource xslResource, ResultTransformer resultTransformer)
           
XsltPayloadTransformer(javax.xml.transform.Templates templates)
           
XsltPayloadTransformer(javax.xml.transform.Templates templates, ResultTransformer resultTransformer)
           
 
Method Summary
protected  java.lang.Object doTransform(org.springframework.integration.Message<?> message)
           
 java.lang.String getComponentType()
           
 void setAlwaysUseResultFactory(boolean alwaysUseResultFactory)
          Specify whether to always use result factory even for directly supported payload types
 void setAlwaysUseSourceFactory(boolean alwaysUseSourceFactory)
          Specify whether to always use source factory even for directly supported payload types.
 void setResultFactory(ResultFactory resultFactory)
          Sets the ResultFactory
 void setSourceFactory(SourceFactory sourceFactory)
          Sets the SourceFactory.
 void setXslParameterMappings(java.util.Map<java.lang.String,org.springframework.expression.Expression> xslParameterMappings)
           
 void setXsltParamHeaders(java.lang.String[] xsltParamHeaders)
           
 
Methods inherited from class org.springframework.integration.transformer.AbstractTransformer
transform
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XsltPayloadTransformer

public XsltPayloadTransformer(javax.xml.transform.Templates templates)
                       throws javax.xml.parsers.ParserConfigurationException
Throws:
javax.xml.parsers.ParserConfigurationException

XsltPayloadTransformer

public XsltPayloadTransformer(org.springframework.core.io.Resource xslResource)
                       throws java.lang.Exception
Throws:
java.lang.Exception

XsltPayloadTransformer

public XsltPayloadTransformer(org.springframework.core.io.Resource xslResource,
                              ResultTransformer resultTransformer)
                       throws java.lang.Exception
Throws:
java.lang.Exception

XsltPayloadTransformer

public XsltPayloadTransformer(javax.xml.transform.Templates templates,
                              ResultTransformer resultTransformer)
                       throws javax.xml.parsers.ParserConfigurationException
Throws:
javax.xml.parsers.ParserConfigurationException
Method Detail

setSourceFactory

public void setSourceFactory(SourceFactory sourceFactory)
Sets the SourceFactory.


setResultFactory

public void setResultFactory(ResultFactory resultFactory)
Sets the ResultFactory


setAlwaysUseSourceFactory

public void setAlwaysUseSourceFactory(boolean alwaysUseSourceFactory)
Specify whether to always use source factory even for directly supported payload types.


setAlwaysUseResultFactory

public void setAlwaysUseResultFactory(boolean alwaysUseResultFactory)
Specify whether to always use result factory even for directly supported payload types


setXslParameterMappings

public void setXslParameterMappings(java.util.Map<java.lang.String,org.springframework.expression.Expression> xslParameterMappings)

setXsltParamHeaders

public void setXsltParamHeaders(java.lang.String[] xsltParamHeaders)

getComponentType

public java.lang.String getComponentType()
Specified by:
getComponentType in interface org.springframework.integration.context.NamedComponent
Overrides:
getComponentType in class org.springframework.integration.context.IntegrationObjectSupport

doTransform

protected java.lang.Object doTransform(org.springframework.integration.Message<?> message)
                                throws java.lang.Exception
Specified by:
doTransform in class org.springframework.integration.transformer.AbstractTransformer
Throws:
java.lang.Exception