Java Doc for AbstractXsltView.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » servlet » view » xslt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.web.servlet.view.xslt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.web.servlet.view.AbstractView
   org.springframework.web.servlet.view.xslt.AbstractXsltView

AbstractXsltView
abstract public class AbstractXsltView extends AbstractView (Code)
Convenient superclass for views rendered using an XSLT stylesheet.

Subclasses typically must provide the Source to transform by overriding AbstractXsltView.createXsltSource . Subclasses do not need to concern themselves with XSLT other than providing a valid stylesheet location.

Properties:

Note that setting AbstractXsltView.setCache(boolean) "cache" to false will cause the template objects to be reloaded for each rendering. This is useful during development, but will seriously affect performance in production and is not thread-safe.
author:
   Rod Johnson
author:
   Juergen Hoeller
author:
   Darren Davison



Field Summary
final public static  StringDEFAULT_ROOT
    
final public static  StringXML_CONTENT_TYPE
    

Constructor Summary
protected  AbstractXsltView()
     This constructor sets the content type to "text/xml;charset=ISO-8859-1" by default.

Method Summary
protected  voidapplyTransformerParameters(Map parameters, Transformer transformer)
     Apply the specified parameters to the given Transformer.
protected  TransformerbuildTransformer(Map parameters)
     Build a Transformer object for immediate use, based on the given parameters.
protected  SourcecreateXsltSource(Map model, String root, HttpServletRequest request, HttpServletResponse response)
     Return the XML Source to transform.
Parameters:
  model - the model Map
Parameters:
  root - name for root element.
protected  voiddoTransform(Map model, Source source, HttpServletRequest request, HttpServletResponse response)
     Perform the actual transformation, writing to the HTTP response.
protected  voiddoTransform(Source source, Map parameters, Result result, String encoding)
     Perform the actual transformation, writing to the given result.
protected  MapgetParameters(Map model, HttpServletRequest request)
     Return a Map of transformer parameters to be applied to the stylesheet.
protected  MapgetParameters(HttpServletRequest request)
     Return a Map of transformer parameters to be applied to the stylesheet.
protected  MapgetParameters()
     Return a Map of transformer parameters to be applied to the stylesheet.
protected  ResourcegetStylesheetLocation()
     Return the location of the XSLT stylesheet, if any.
protected  SourcegetStylesheetSource(Resource stylesheetLocation)
     Load the stylesheet from the specified location.
protected  TemplatesgetTemplates()
     Obtain the Templates object to use, based on the configured stylesheet, either a cached one or a freshly built one.

Subclasses may override this method e.g.

final protected  TransformerFactorygetTransformerFactory()
     Return the TransformerFactory used by this view.
final protected  voidinitApplicationContext()
     Here we load our template, as we need the org.springframework.context.ApplicationContext to do it.
final protected  voidrenderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
    
final public  voidresetCachedTemplates()
     Reset the cached Templates object, if any.
public  voidsetCache(boolean cache)
     Set whether to activate the template cache for this view.

Default is true.

public  voidsetContentType(String contentType)
    
public  voidsetErrorListener(ErrorListener errorListener)
     Set an implementation of the javax.xml.transform.ErrorListener interface for custom handling of transformation errors and warnings.
public  voidsetIndent(boolean indent)
     Set whether the XSLT transformer may add additional whitespace when outputting the result tree.
public  voidsetOutputProperties(Properties outputProperties)
     Set arbitrary transformer output properties to be applied to the stylesheet.
public  voidsetRoot(String root)
     The document root element name.
public  voidsetStylesheetLocation(Resource stylesheetLocation)
     Set the location of the XSLT stylesheet.
public  voidsetUriResolver(URIResolver uriResolver)
     Set the URIResolver used in the transform.
public  voidsetUseSingleModelNameAsRoot(boolean useSingleModelNameAsRoot)
     Set whether to use the name of a given single model object as the document root element name.

Default is true : If you pass in a model with a single object named "myElement", then the document root will be named "myElement" as well.

protected  booleanuseWriter()
     Return whether to use a java.io.Writer to write text content to the HTTP response.

Field Detail
DEFAULT_ROOT
final public static String DEFAULT_ROOT(Code)
The default document root name



XML_CONTENT_TYPE
final public static String XML_CONTENT_TYPE(Code)
The default content type if no stylesheet specified




Constructor Detail
AbstractXsltView
protected AbstractXsltView()(Code)
This constructor sets the content type to "text/xml;charset=ISO-8859-1" by default. This will be switched to the standard web view default "text/html;charset=ISO-8859-1" if a stylesheet location has been specified.

A specific content type can be configured via the AbstractXsltView.setContentType "contentType" bean property.





Method Detail
applyTransformerParameters
protected void applyTransformerParameters(Map parameters, Transformer transformer)(Code)
Apply the specified parameters to the given Transformer.
Parameters:
  parameters - the transformer parameters(as determined by AbstractXsltView.getParameters(Map,HttpServletRequest))
Parameters:
  transformer - the Transformer to aply the parameters



buildTransformer
protected Transformer buildTransformer(Map parameters) throws TransformerConfigurationException(Code)
Build a Transformer object for immediate use, based on the given parameters.
Parameters:
  parameters - a Map of parameters to be applied to the stylesheet(as determined by AbstractXsltView.getParameters(Map,HttpServletRequest)) the Transformer object (never null)
throws:
  TransformerConfigurationException - if the Transformer objectcould not be built



createXsltSource
protected Source createXsltSource(Map model, String root, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
Return the XML Source to transform.
Parameters:
  model - the model Map
Parameters:
  root - name for root element. This can be supplied as a bean propertyto concrete subclasses within the view definition file, but will be overriddenin the case of a single object in the model map to be the key for that object.If no root property is specified and multiple model objects exist, a defaultroot tag name will be supplied.
Parameters:
  request - HTTP request. Subclasses won't normally use this, asrequest processing should have been complete. However, we might want tocreate a RequestContext to expose as part of the model.
Parameters:
  response - HTTP response. Subclasses won't normally use this,however there may sometimes be a need to set cookies. the XSLT Source to transform
throws:
  Exception - if an error occurs



doTransform
protected void doTransform(Map model, Source source, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
Perform the actual transformation, writing to the HTTP response.

The default implementation delegates to the AbstractXsltView.doTransform(javax.xml.transform.Source,java.util.Map,javax.xml.transform.Result,String) method, building a StreamResult for the ServletResponse OutputStream or for the ServletResponse Writer (according to AbstractXsltView.useWriter() ).
Parameters:
  model - the model Map
Parameters:
  source - the Source to transform
Parameters:
  request - current HTTP request
Parameters:
  response - current HTTP response
throws:
  Exception - if an error occurs
See Also:   javax.xml.transform.stream.StreamResult
See Also:   javax.servlet.ServletResponse.getOutputStream
See Also:   javax.servlet.ServletResponse.getWriter
See Also:   AbstractXsltView.useWriter()




doTransform
protected void doTransform(Source source, Map parameters, Result result, String encoding) throws Exception(Code)
Perform the actual transformation, writing to the given result.
Parameters:
  source - the Source to transform
Parameters:
  parameters - a Map of parameters to be applied to the stylesheet(as determined by AbstractXsltView.getParameters(Map,HttpServletRequest))
Parameters:
  result - the result to write to
Parameters:
  encoding - the preferred character encoding that the underlying Transformer should use
throws:
  Exception - if an error occurs



getParameters
protected Map getParameters(Map model, HttpServletRequest request)(Code)
Return a Map of transformer parameters to be applied to the stylesheet.

Subclasses can override this method in order to apply one or more parameters to the transformation process.

The default implementation delegates to the AbstractXsltView.getParameters(HttpServletRequest) variant.
Parameters:
  model - the model Map
Parameters:
  request - current HTTP request a Map of parameters to apply to the transformation process
See Also:   AbstractXsltView.getParameters()
See Also:   javax.xml.transform.Transformer.setParameter




getParameters
protected Map getParameters(HttpServletRequest request)(Code)
Return a Map of transformer parameters to be applied to the stylesheet.

Subclasses can override this method in order to apply one or more parameters to the transformation process.

The default implementation delegates to the simple AbstractXsltView.getParameters() variant.
Parameters:
  request - current HTTP request a Map of parameters to apply to the transformation process
See Also:   AbstractXsltView.getParameters(Map,HttpServletRequest)
See Also:   javax.xml.transform.Transformer.setParameter




getParameters
protected Map getParameters()(Code)
Return a Map of transformer parameters to be applied to the stylesheet. a Map of parameters to apply to the transformation processAbstractXsltView.getParameters(HttpServletRequest)



getStylesheetLocation
protected Resource getStylesheetLocation()(Code)
Return the location of the XSLT stylesheet, if any.



getStylesheetSource
protected Source getStylesheetSource(Resource stylesheetLocation) throws ApplicationContextException(Code)
Load the stylesheet from the specified location.
Parameters:
  stylesheetLocation - the stylesheet resource to be loaded the stylesheet source
throws:
  ApplicationContextException - if the stylesheet resource could not be loaded



getTemplates
protected Templates getTemplates() throws TransformerConfigurationException(Code)
Obtain the Templates object to use, based on the configured stylesheet, either a cached one or a freshly built one.

Subclasses may override this method e.g. in order to refresh the Templates instance, calling AbstractXsltView.resetCachedTemplates() before delegating to this getTemplates() implementation. the Templates object (or null if there isno stylesheet specified)
throws:
  TransformerConfigurationException - if the Templates objectcould not be built
See Also:   AbstractXsltView.setStylesheetLocation
See Also:   AbstractXsltView.setCache
See Also:   AbstractXsltView.resetCachedTemplates




getTransformerFactory
final protected TransformerFactory getTransformerFactory()(Code)
Return the TransformerFactory used by this view. Available once the View object has been fully initialized.



initApplicationContext
final protected void initApplicationContext() throws ApplicationContextException(Code)
Here we load our template, as we need the org.springframework.context.ApplicationContext to do it.



renderMergedOutputModel
final protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)



resetCachedTemplates
final public void resetCachedTemplates()(Code)
Reset the cached Templates object, if any.

The Templates object will subsequently be rebuilt on next AbstractXsltView.getTemplates() access , if caching is enabled.
See Also:   AbstractXsltView.setCache




setCache
public void setCache(boolean cache)(Code)
Set whether to activate the template cache for this view.

Default is true. Turn this off to refresh the Templates object on every access, e.g. during development.
See Also:   AbstractXsltView.resetCachedTemplates()




setContentType
public void setContentType(String contentType)(Code)



setErrorListener
public void setErrorListener(ErrorListener errorListener)(Code)
Set an implementation of the javax.xml.transform.ErrorListener interface for custom handling of transformation errors and warnings.

If not set, a default org.springframework.util.xml.SimpleTransformErrorListener is used that simply logs warnings using the logger instance of the view class, and rethrows errors to discontinue the XML transformation.
See Also:   org.springframework.util.xml.SimpleTransformErrorListener




setIndent
public void setIndent(boolean indent)(Code)
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.
See Also:   javax.xml.transform.OutputKeys.INDENT




setOutputProperties
public void setOutputProperties(Properties outputProperties)(Code)
Set arbitrary transformer output properties to be applied to the stylesheet.

Any values specified here will override defaults that this view sets programmatically.
See Also:   javax.xml.transform.Transformer.setOutputProperty




setRoot
public void setRoot(String root)(Code)
The document root element name. Default is AbstractXsltView.DEFAULT_ROOT "DocRoot" .

Only used if we're not passed a single Node as the model.
Parameters:
  root - the document root element name
See Also:   AbstractXsltView.DEFAULT_ROOT




setStylesheetLocation
public void setStylesheetLocation(Resource stylesheetLocation)(Code)
Set the location of the XSLT stylesheet.

If the TransformerFactory used by this instance has already been initialized then invoking this setter will result in the TransformerFactory.newTemplates(javax.xml.transform.Source) attendant templates being re-cached.
Parameters:
  stylesheetLocation - the location of the XSLT stylesheet
See Also:   org.springframework.context.ApplicationContext.getResource




setUriResolver
public void setUriResolver(URIResolver uriResolver)(Code)
Set the URIResolver used in the transform.

The URIResolver handles calls to the XSLT document() function.




setUseSingleModelNameAsRoot
public void setUseSingleModelNameAsRoot(boolean useSingleModelNameAsRoot)(Code)
Set whether to use the name of a given single model object as the document root element name.

Default is true : If you pass in a model with a single object named "myElement", then the document root will be named "myElement" as well. Set this flag to false if you want to pass in a single model object while still using the root element name configured through the AbstractXsltView.setRoot(String) "root" property .
Parameters:
  useSingleModelNameAsRoot - true if the name of a given singlemodel object is to be used as the document root element name
See Also:   AbstractXsltView.setRoot




useWriter
protected boolean useWriter()(Code)
Return whether to use a java.io.Writer to write text content to the HTTP response. Else, a java.io.OutputStream will be used, to write binary content to the response.

The default implementation returns false, indicating a a java.io.OutputStream. whether to use a Writer (true) or an OutputStream(false)
See Also:   javax.servlet.ServletResponse.getWriter
See Also:   javax.servlet.ServletResponse.getOutputStream




Fields inherited from org.springframework.web.servlet.view.AbstractView
final public static String DEFAULT_CONTENT_TYPE(Code)(Java Doc)

Methods inherited from org.springframework.web.servlet.view.AbstractView
public void addStaticAttribute(String name, Object value)(Code)(Java Doc)
protected RequestContext createRequestContext(HttpServletRequest request, Map model)(Code)(Java Doc)
protected void exposeModelAsRequestAttributes(Map model, HttpServletRequest request) throws Exception(Code)(Java Doc)
public Map getAttributesMap()(Code)(Java Doc)
public String getBeanName()(Code)(Java Doc)
public String getContentType()(Code)(Java Doc)
public String getRequestContextAttribute()(Code)(Java Doc)
public Map getStaticAttributes()(Code)(Java Doc)
public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)
abstract protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)
public void setAttributes(Properties attributes)(Code)(Java Doc)
public void setAttributesCSV(String propString) throws IllegalArgumentException(Code)(Java Doc)
public void setAttributesMap(Map attributes)(Code)(Java Doc)
public void setBeanName(String beanName)(Code)(Java Doc)
public void setContentType(String contentType)(Code)(Java Doc)
public void setRequestContextAttribute(String requestContextAttribute)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.