Java Doc for AbstractPdfView.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » servlet » view » document » 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.document 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.web.servlet.view.AbstractView
   org.springframework.web.servlet.view.document.AbstractPdfView

AbstractPdfView
abstract public class AbstractPdfView extends AbstractView (Code)
Abstract superclass for PDF views, using Bruno Lowagie's iText package. Application-specific view classes will extend this class. The view will be held in the subclass itself, not in a template.

Note: Internet Explorer requires a ".pdf" extension, as it doesn't always respect the declared content type.
author:
   Rod Johnson
author:
   Jean-Pierre Pawlak
author:
   Juergen Hoeller




Constructor Summary
public  AbstractPdfView()
     This constructor sets the appropriate content type "application/pdf". Note that IE won't take much notice of this, but there's not a lot we can do about this.

Method Summary
abstract protected  voidbuildPdfDocument(Map model, Document document, PdfWriter writer, HttpServletRequest request, HttpServletResponse response)
     Subclasses must implement this method to build an iText PDF document, given the model.
protected  voidbuildPdfMetadata(Map model, Document document, HttpServletRequest request)
     Populate the iText Document's meta fields (author, title, etc.).
Default is an empty implementation.
protected  intgetViewerPreferences()
     Return the viewer preferences for the PDF file.
protected  DocumentnewDocument()
     Create a new document to hold the PDF contents.
protected  PdfWriternewWriter(Document document, OutputStream os)
     Create a new PdfWriter for the given iText Document.
protected  voidprepareWriter(Map model, PdfWriter writer, HttpServletRequest request)
     Prepare the given PdfWriter.
final protected  voidrenderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
    


Constructor Detail
AbstractPdfView
public AbstractPdfView()(Code)
This constructor sets the appropriate content type "application/pdf". Note that IE won't take much notice of this, but there's not a lot we can do about this. Generated documents should have a ".pdf" extension.




Method Detail
buildPdfDocument
abstract protected void buildPdfDocument(Map model, Document document, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
Subclasses must implement this method to build an iText PDF document, given the model. Called between Document.open() and Document.close() calls.

Note that the passed-in HTTP response is just supposed to be used for setting cookies or other HTTP headers. The built PDF document itself will automatically get written to the response after this method returns.
Parameters:
  model - the model Map
Parameters:
  document - the iText Document to add elements to
Parameters:
  writer - the PdfWriter to use
Parameters:
  request - in case we need locale etc. Shouldn't look at attributes.
Parameters:
  response - in case we need to set cookies. Shouldn't write to it.
throws:
  Exception - any exception that occured during document building
See Also:   com.lowagie.text.Document.open
See Also:   com.lowagie.text.Document.close




buildPdfMetadata
protected void buildPdfMetadata(Map model, Document document, HttpServletRequest request)(Code)
Populate the iText Document's meta fields (author, title, etc.).
Default is an empty implementation. Subclasses may override this method to add meta fields such as title, subject, author, creator, keywords, etc. This method is called after assigning a PdfWriter to the Document and before calling document.open().
Parameters:
  model - the model, in case meta information must be populated from it
Parameters:
  document - the iText document being populated
Parameters:
  request - in case we need locale etc. Shouldn't look at attributes.
See Also:   com.lowagie.text.Document.addTitle
See Also:   com.lowagie.text.Document.addSubject
See Also:   com.lowagie.text.Document.addKeywords
See Also:   com.lowagie.text.Document.addAuthor
See Also:   com.lowagie.text.Document.addCreator
See Also:   com.lowagie.text.Document.addProducer
See Also:   com.lowagie.text.Document.addCreationDate
See Also:   com.lowagie.text.Document.addHeader



getViewerPreferences
protected int getViewerPreferences()(Code)
Return the viewer preferences for the PDF file.

By default returns AllowPrinting and PageLayoutSinglePage, but can be subclassed. The subclass can either have fixed preferences or retrieve them from bean properties defined on the View. an int containing the bits information against PdfWriter definitions
See Also:   com.lowagie.text.pdf.PdfWriter.AllowPrinting
See Also:   com.lowagie.text.pdf.PdfWriter.PageLayoutSinglePage




newDocument
protected Document newDocument()(Code)
Create a new document to hold the PDF contents.

By default returns an A4 document, but the subclass can specify any Document, possibly parameterized via bean properties defined on the View. the newly created iText Document instance
See Also:   com.lowagie.text.Document.Document(com.lowagie.text.Rectangle)




newWriter
protected PdfWriter newWriter(Document document, OutputStream os) throws DocumentException(Code)
Create a new PdfWriter for the given iText Document.
Parameters:
  document - the iText Document to create a writer for
Parameters:
  os - the OutputStream to write to the PdfWriter instance to use
throws:
  DocumentException - if thrown during writer creation



prepareWriter
protected void prepareWriter(Map model, PdfWriter writer, HttpServletRequest request) throws DocumentException(Code)
Prepare the given PdfWriter. Called before building the PDF document, that is, before the call to Document.open().

Useful for registering a page event listener, for example. The default implementation sets the viewer preferences as returned by this class's getViewerPreferences() method.
Parameters:
  model - the model, in case meta information must be populated from it
Parameters:
  writer - the PdfWriter to prepare
Parameters:
  request - in case we need locale etc. Shouldn't look at attributes.
throws:
  DocumentException - if thrown during writer preparation
See Also:   com.lowagie.text.Document.open
See Also:   com.lowagie.text.pdf.PdfWriter.setPageEvent
See Also:   com.lowagie.text.pdf.PdfWriter.setViewerPreferences
See Also:   AbstractPdfView.getViewerPreferences()




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



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.