Java Doc for XsltView.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.AbstractUrlBasedView
   org.springframework.web.servlet.view.xslt.XsltView

XsltView
public class XsltView extends AbstractUrlBasedView (Code)
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 XsltView.locateSource detected during response rendering. Users can either specify a specific entry in the model via the XsltView.setSourceKey sourceKey property or have Spring locate the Source object. This class also provides basic conversion of objects into Source implementations. See XsltView.getSourceTypes() here for more details.

All model parameters are passed to the XSLT Transformer as parameters. In addition the user can configure XsltView.setOutputProperties output properties to be passed to the Transformer.
author:
   Rob Harrop
author:
   Juergen Hoeller
since:
   2.0





Method Summary
final protected  voidconfigureIndentation(Transformer transformer)
     Configure the indentation settings for the supplied Transformer .
protected  voidconfigureResponse(Map model, HttpServletResponse response, Transformer transformer)
     Configure the supplied HttpServletResponse .
protected  voidconfigureTransformer(Map model, HttpServletResponse response, Transformer transformer)
     Configure the supplied Transformer instance.
protected  SourceconvertSource(Object source)
     Convert the supplied Object into an XSLT Source if the Object type is XsltView.getSourceTypes() supported .
final protected  voidcopyModelParameters(Map model, Transformer transformer)
     Copy all entries from the supplied Map into the Transformer.setParameter(StringObject) parameter set of the supplied Transformer .
final protected  voidcopyOutputProperties(Transformer transformer)
     Copy the configured output Properties , if any, into the Transformer.setOutputProperty output property set of the supplied Transformer .
protected  ResultcreateResult(HttpServletResponse response)
     Create the XSLT Result used to render the result of the transformation.
protected  TransformercreateTransformer(Templates templates)
     Create the Transformer instance used to prefer the XSLT transformation.
protected  Class[]getSourceTypes()
     Return the array of Class Classes that are supported when converting to an XSLT Source .
protected  SourcegetStylesheetSource()
     Get the XSLT Source for the XSLT template under the XsltView.setUrl configured URL .
final protected  TransformerFactorygetTransformerFactory()
     Return the TransformerFactory that this XsltView uses.
protected  voidinitApplicationContext()
     Initialize this XsltView's TransformerFactory.
protected  SourcelocateSource(Map model)
    

Locate the Source object in the supplied model, converting objects as required.

protected  voidrenderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
    
public  voidsetCacheTemplates(boolean cacheTemplates)
     Turn on/off the caching of the XSLT Templates instance.

The default value is "true".

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  voidsetSourceKey(String sourceKey)
     Set the name of the model attribute that represents the XSLT Source.
public  voidsetUriResolver(URIResolver uriResolver)
     Set the URIResolver used in the transform.



Method Detail
configureIndentation
final protected void configureIndentation(Transformer transformer)(Code)
Configure the indentation settings for the supplied Transformer .
Parameters:
  transformer - the target transformer
throws:
  IllegalArgumentException - if the supplied Transformer is null
See Also:   TransformerUtils.enableIndenting(javax.xml.transform.Transformer)
See Also:   
See Also:   TransformerUtils.disableIndenting(javax.xml.transform.Transformer)



configureResponse
protected void configureResponse(Map model, HttpServletResponse response, Transformer transformer)(Code)
Configure the supplied HttpServletResponse .

The default implementation of this method sets the HttpServletResponse.setContentType content type and HttpServletResponse.setCharacterEncoding encoding from the "media-type" and "encoding" output properties specified in the Transformer .
Parameters:
  model - merged output Map (never null)
Parameters:
  response - current HTTP response
Parameters:
  transformer - the target transformer




configureTransformer
protected void configureTransformer(Map model, HttpServletResponse response, Transformer transformer)(Code)
Configure the supplied Transformer instance.

The default implementation copies parameters from the model into the Transformer's Transformer.setParameter parameter set . This implementation also copies the XsltView.setOutputProperties output properties into the Transformer Transformer.setOutputProperty output properties . Indentation properties are set as well.
Parameters:
  model - merged output Map (never null)
Parameters:
  response - current HTTP response
Parameters:
  transformer - the target transformer
See Also:   XsltView.copyModelParameters(Map,Transformer)
See Also:   XsltView.copyOutputProperties(Transformer)
See Also:   XsltView.configureIndentation(Transformer)




convertSource
protected Source convertSource(Object source) throws Exception(Code)
Convert the supplied Object into an XSLT Source if the Object type is XsltView.getSourceTypes() supported .
Parameters:
  source - the original source object the adapted XSLT Source
throws:
  IllegalArgumentException - if the given Object is not of a supported type



copyModelParameters
final protected void copyModelParameters(Map model, Transformer transformer)(Code)
Copy all entries from the supplied Map into the Transformer.setParameter(StringObject) parameter set of the supplied Transformer .
Parameters:
  model - merged output Map (never null)
Parameters:
  transformer - the target transformer



copyOutputProperties
final protected void copyOutputProperties(Transformer transformer)(Code)
Copy the configured output Properties , if any, into the Transformer.setOutputProperty output property set of the supplied Transformer .
Parameters:
  transformer - the target transformer



createResult
protected Result createResult(HttpServletResponse response) throws Exception(Code)
Create the XSLT Result used to render the result of the transformation.

The default implementation creates a StreamResult wrapping the supplied HttpServletResponse's HttpServletResponse.getOutputStream OutputStream .
Parameters:
  response - current HTTP response the XSLT Result to use
throws:
  Exception - if the Result cannot be built




createTransformer
protected Transformer createTransformer(Templates templates) throws TransformerConfigurationException(Code)
Create the Transformer instance used to prefer the XSLT transformation.

The default implementation simply calls Templates.newTransformer , and configures the Transformer with the custom URIResolver if specified.
Parameters:
  templates - the XSLT Templates instance to create a Transformer for




getSourceTypes
protected Class[] getSourceTypes()(Code)
Return the array of Class Classes that are supported when converting to an XSLT Source .

Currently supports Source , Document , Node , Reader , InputStream and Resource . the supported source types




getStylesheetSource
protected Source getStylesheetSource()(Code)
Get the XSLT Source for the XSLT template under the XsltView.setUrl configured URL .



getTransformerFactory
final protected TransformerFactory getTransformerFactory()(Code)
Return the TransformerFactory that this XsltView uses. the TransformerFactory (never null)



initApplicationContext
protected void initApplicationContext() throws BeansException(Code)
Initialize this XsltView's TransformerFactory.



locateSource
protected Source locateSource(Map model) throws Exception(Code)

Locate the Source object in the supplied model, converting objects as required. The default implementation first attempts to look under the configured XsltView.setSourceKey source key , if any, before attempting to locate an object of XsltView.getSourceTypes() supported type .
Parameters:
  model - the merged model Map the XSLT Source object (or null if none found)
throws:
  Exception - if an error occured during locating the source
See Also:   XsltView.setSourceKey
See Also:   XsltView.convertSource




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



setCacheTemplates
public void setCacheTemplates(boolean cacheTemplates)(Code)
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.




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




setSourceKey
public void setSourceKey(String sourceKey)(Code)
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: Source , Document , Node , Reader , InputStream and Resource .
See Also:   XsltView.getSourceTypes
See Also:   XsltView.convertSource




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

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




Methods inherited from org.springframework.web.servlet.view.AbstractUrlBasedView
public void afterPropertiesSet() throws Exception(Code)(Java Doc)
public String getUrl()(Code)(Java Doc)
public void setUrl(String url)(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.