java.lang.Object | |||||
↳ | org.springframework.context.support.ApplicationObjectSupport | ||||
↳ | org.springframework.web.context.support.WebApplicationObjectSupport | ||||
↳ | org.springframework.web.servlet.view.AbstractView | ||||
↳ | org.springframework.web.servlet.view.AbstractUrlBasedView | ||||
↳ | org.springframework.web.servlet.view.xslt.XsltView |
XSLT-driven View that allows for response context to be rendered as the result of an XSLT transformation.
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.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.servlet.view.AbstractView
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.context.support.ApplicationObjectSupport
| |||||||||||
From interface
org.springframework.web.servlet.View
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Turn on/off the caching of the XSLT
Templates instance. | |||||||||||
Set an implementation of the
ErrorListener
interface for custom handling of transformation errors and warnings. | |||||||||||
Set whether the XSLT transformer may add additional whitespace when
outputting the result tree.
| |||||||||||
Set arbitrary transformer output properties to be applied to the stylesheet.
| |||||||||||
Set the name of the model attribute that represents the XSLT Source.
| |||||||||||
Specify the XSLT TransformerFactory class to use.
| |||||||||||
Set the URIResolver used in the transform.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Configure the indentation settings for the supplied
Transformer . | |||||||||||
Configure the supplied HttpServletResponse.
| |||||||||||
Configure the supplied
Transformer instance. | |||||||||||
Copy all entries from the supplied Map into the
parameter set
of the supplied Transformer . | |||||||||||
Copy the configured output
Properties , if any, into the
output property set of the supplied
Transformer . | |||||||||||
Create the XSLT
Result used to render the result of the transformation. | |||||||||||
Create the
Transformer instance used to prefer the XSLT transformation. | |||||||||||
Get the XSLT
Source for the XSLT template under the configured URL . | |||||||||||
Return the TransformerFactory that this XsltView uses.
| |||||||||||
Initialize this XsltView's TransformerFactory.
| |||||||||||
Locate the | |||||||||||
Instantiate a new TransformerFactory for this view.
| |||||||||||
Subclasses must implement this method to actually render the view.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.servlet.view.AbstractUrlBasedView
| |||||||||||
From class
org.springframework.web.servlet.view.AbstractView
| |||||||||||
From class
org.springframework.web.context.support.WebApplicationObjectSupport
| |||||||||||
From class
org.springframework.context.support.ApplicationObjectSupport
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.BeanNameAware
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
| |||||||||||
From interface
org.springframework.context.ApplicationContextAware
| |||||||||||
From interface
org.springframework.web.context.ServletContextAware
| |||||||||||
From interface
org.springframework.web.servlet.View
|
Turn on/off the caching of the XSLT Templates
instance.
The default value is "true". Only set this to "false" in development, where caching does not seriously impact performance.
Set an implementation of the ErrorListener
interface for custom handling of transformation errors and warnings.
If not set, a default
SimpleTransformErrorListener
is
used that simply logs warnings using the logger instance of the view class,
and rethrows errors to discontinue the XML transformation.
Set whether the XSLT transformer may add additional whitespace when outputting the result tree.
Default is true
(on); set this to false
(off)
to not specify an "indent" key, leaving the choice up to the stylesheet.
Set arbitrary transformer output properties to be applied to the stylesheet.
Any values specified here will override defaults that this view sets programmatically.
Specify the XSLT TransformerFactory class to use.
The default constructor of the specified class will be called to build the TransformerFactory for this view.
Set the URIResolver used in the transform.
The URIResolver handles calls to the XSLT document()
function.
Configure the indentation settings for the supplied Transformer
.
transformer | the target transformer |
---|
Configure the supplied HttpServletResponse.
The default implementation of this method sets the
content type
and
encoding
from the "media-type" and "encoding" output properties
specified in the Transformer
.
model | merged output Map (never null ) |
---|---|
response | current HTTP response |
transformer | the target transformer |
Configure the supplied Transformer
instance.
The default implementation copies parameters from the model into the
Transformer's parameter set
.
This implementation also copies the output properties
into the Transformer
output properties
.
Indentation properties are set as well.
model | merged output Map (never null ) |
---|---|
response | current HTTP response |
transformer | the target transformer |
Copy all entries from the supplied Map into the
parameter set
of the supplied Transformer
.
model | merged output Map (never null ) |
---|---|
transformer | the target transformer |
Copy the configured output Properties
, if any, into the
output property set
of the supplied
Transformer
.
transformer | the target transformer |
---|
Create the XSLT Result
used to render the result of the transformation.
The default implementation creates a StreamResult
wrapping the supplied
HttpServletResponse's OutputStream
.
response | current HTTP response |
---|
Exception | if the Result cannot be built |
---|
Create the Transformer
instance used to prefer the XSLT transformation.
The default implementation simply calls newTransformer()
, and
configures the Transformer
with the custom URIResolver
if specified.
templates | the XSLT Templates instance to create a Transformer for |
---|
TransformerConfigurationException | in case of creation failure |
---|
Get the XSLT Source
for the XSLT template under the configured URL
.
Return the TransformerFactory that this XsltView uses.
null
)
Initialize this XsltView's TransformerFactory.
BeansException |
---|
Locate the Source
object in the supplied model,
converting objects as required.
The default implementation first attempts to look under the configured
source key
, if any, before attempting to locate
an object of supported type
.
model | the merged model Map |
---|
null
if none found)Exception | if an error occured during locating the source |
---|
Instantiate a new TransformerFactory for this view.
The default implementation simply calls
newInstance()
.
If a "transformerFactoryClass"
has been specified explicitly, the default constructor of the
specified class will be called instead.
Can be overridden in subclasses.
transformerFactoryClass | the specified factory class (if any) |
---|
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.
model | combined output Map (never null ),
with dynamic values taking precedence over static attributes |
---|---|
request | current HTTP request |
response | current HTTP response |
Exception |
---|