The XSLT Source object is supplied as a parameter in the model and then
detected during response rendering. Users can either specify
a specific entry in the model via the sourceKey property or
have Spring locate the Source object. This class also provides basic conversion
of objects into Source implementations. See here
for more details.
All model parameters are passed to the XSLT Transformer as parameters.
In addition the user can configure output properties
to be passed to the Transformer.
| Modifier and Type | Field and Description |
|---|---|
| private Templates | |
| private boolean | |
| private ErrorListener | |
| private boolean | |
| private Properties | |
| private String | |
| private TransformerFactory | |
| private Class | |
| private URIResolver |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | closeSourceIfNecessary(Source
the XSLT Source to close (may be source)null)Close the underlying resource managed by the supplied |
| protected final void | configureIndentation(Transformer
the target transformer transformer)Configure the indentation settings for the supplied |
| protected void | configureResponse(Map<String, Object>
merged output Map (never model, HttpServletResponse null)current HTTP response response, Transformer the target transformer transformer)Configure the supplied |
| protected void | configureTransformer(Map<String, Object>
merged output Map (never model, HttpServletResponse null)current HTTP response response, Transformer the target transformer transformer)Configure the supplied |
| protected Source | |
| protected final void | copyModelParameters(Map<String, Object>
merged output Map (never model, Transformer null)the target transformer transformer)Copy all entries from the supplied Map into the
|
| protected final void | copyOutputProperties(Transformer
the target transformer transformer)Copy the configured output |
| protected Result | Returns: the XSLT Result to usecurrent HTTP response response)Create the XSLT |
| protected Transformer | Returns: the Transformer objectthe XSLT Templates instance to create a Transformer for templates)Create the |
| protected Class | Returns: the supported source typesReturn the array of |
| protected Source | Returns: the Source objectGet the XSLT |
| protected final TransformerFactory | Returns: the TransformerFactory (nevernull)Return the TransformerFactory that this XsltView uses. |
| protected void | initApplicationContext()
Overrides org. Initialize this XsltView's TransformerFactory. |
| private Templates | |
| protected Source | Returns: the XSLT Source object (ornull if none found)the merged model Map model)Locate the |
| protected TransformerFactory | Returns: the new TransactionFactory instancethe specified factory class (if any) transformerFactoryClass)Instantiate a new TransformerFactory for this view. |
| protected void | renderMergedOutputModel(Map<String, Object>
combined output Map (never model, HttpServletRequest null),
with dynamic values taking precedence over static attributescurrent HTTP request request, HttpServletResponse current HTTP response response)Implements abstract org. Subclasses must implement this method to actually render the view. |
| public void | |
| public void | setErrorListener(ErrorListener errorListener)
Set an implementation of the |
| public void | setIndent(boolean indent)
Set whether the XSLT transformer may add additional whitespace when outputting the result tree. |
| public void | setOutputProperties(Properties outputProperties)
Set arbitrary transformer output properties to be applied to the stylesheet. |
| public void | |
| public void | setTransformerFactoryClass(Class<? extends TransformerFactory> transformerFactoryClass)
Specify the XSLT TransformerFactory class to use. |
| public void |
| cachedTemplates | back to summary |
|---|---|
| private Templates cachedTemplates
| |
| cacheTemplates | back to summary |
|---|---|
| private boolean cacheTemplates | |
| errorListener | back to summary |
|---|---|
| private ErrorListener errorListener | |
| indent | back to summary |
|---|---|
| private boolean indent | |
| outputProperties | back to summary |
|---|---|
| private Properties outputProperties
| |
| sourceKey | back to summary |
|---|---|
| private String sourceKey
| |
| transformerFactory | back to summary |
|---|---|
| private TransformerFactory transformerFactory
| |
| transformerFactoryClass | back to summary |
|---|---|
| private Class<? extends TransformerFactory> transformerFactoryClass
| |
| uriResolver | back to summary |
|---|---|
| private URIResolver uriResolver
| |
| XsltView | back to summary |
|---|---|
| public XsltView() | |
| closeSourceIfNecessary | back to summary |
|---|---|
| private void closeSourceIfNecessary(Source source) Close the underlying resource managed by the supplied Only works for
| |
| configureIndentation | back to summary |
|---|---|
| protected final void configureIndentation(Transformer transformer) Configure the indentation settings for the supplied
| |
| configureResponse | back to summary |
|---|---|
| protected void configureResponse(Map<String, Object> model, HttpServletResponse response, Transformer transformer) Configure the supplied The default implementation of this method sets the
| |
| configureTransformer | back to summary |
|---|---|
| protected void configureTransformer(Map<String, Object> model, HttpServletResponse response, Transformer transformer) Configure the supplied The default implementation copies parameters from the model into the
Transformer's
| |
| convertSource | back to summary |
|---|---|
| protected Source convertSource(Object sourceObject) throws Exception Convert the supplied
| |
| copyModelParameters | back to summary |
|---|---|
| protected final void copyModelParameters(Map<String, Object> model, Transformer transformer) Copy all entries from the supplied Map into the
| |
| copyOutputProperties | back to summary |
|---|---|
| protected final void copyOutputProperties(Transformer transformer) Copy the configured output
| |
| createResult | back to summary |
|---|---|
| protected Result createResult(HttpServletResponse response) throws Exception Create the XSLT The default implementation creates a
| |
| createTransformer | back to summary |
|---|---|
| protected Transformer createTransformer(Templates templates) throws TransformerConfigurationException Create the The default implementation simply calls
| |
| getSourceTypes | back to summary |
|---|---|
| protected Class Return the array of Currently supports
| |
| getStylesheetSource | back to summary |
|---|---|
| protected Source getStylesheetSource() Get the XSLT
| |
| getTransformerFactory | back to summary |
|---|---|
| protected final TransformerFactory getTransformerFactory() Return the TransformerFactory that this XsltView uses.
| |
| initApplicationContext | back to summary |
|---|---|
| protected void initApplicationContext() throws BeansException Overrides org. Initialize this XsltView's TransformerFactory.
| |
| loadTemplates | back to summary |
|---|---|
| private Templates loadTemplates() throws ApplicationContextException Load the | |
| locateSource | back to summary |
|---|---|
| protected Source locateSource(Map<String, Object> model) throws Exception Locate the
| |
| newTransformerFactory | back to summary |
|---|---|
| protected TransformerFactory newTransformerFactory(Class<? extends TransformerFactory> transformerFactoryClass) Instantiate a new TransformerFactory for this view. The default implementation simply calls
Can be overridden in subclasses.
| |
| renderMergedOutputModel | back to summary |
|---|---|
| protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception Implements abstract org. Doc from org. Subclasses must implement this method to actually render the view. The first step will be preparing the request: In the JSP case, this would mean setting model objects as request attributes. The second step will be the actual rendering of the view, for example including the JSP via a RequestDispatcher.
| |
| setCacheTemplates | back to summary |
|---|---|
| public void setCacheTemplates(boolean cacheTemplates) Turn on/off the caching of the XSLT The default value is "true". Only set this to "false" in development, where caching does not seriously impact performance. | |
| setErrorListener | back to summary |
|---|---|
| public void setErrorListener(ErrorListener errorListener) Set an implementation of the If not set, a default
| |
| setIndent | back to summary |
|---|---|
| public void setIndent(boolean indent) Set whether the XSLT transformer may add additional whitespace when outputting the result tree. Default is | |
| setOutputProperties | back to summary |
|---|---|
| public void setOutputProperties(Properties outputProperties) Set arbitrary transformer output properties to be applied to the stylesheet. Any values specified here will override defaults that this view sets programmatically. | |
| setSourceKey | back to summary |
|---|---|
| public void setSourceKey(String sourceKey) Set the name of the model attribute that represents the XSLT Source. If not specified, the model map will be searched for a matching value type. The following source types are supported out of the box:
| |
| setTransformerFactoryClass | back to summary |
|---|---|
| public void setTransformerFactoryClass(Class<? extends TransformerFactory> transformerFactoryClass) Specify the XSLT TransformerFactory class to use. The default constructor of the specified class will be called to build the TransformerFactory for this view. | |
| setUriResolver | back to summary |
|---|---|
| public void setUriResolver(URIResolver uriResolver) Set the URIResolver used in the transform. The URIResolver handles calls to the XSLT | |