Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

15.9. Configuring iText

Document generation works out of the box with no additional configuration needed. However, there are a few points of configuration that are needed for more serious applications.
The default implementation serves PDF documents from a generic URL, /seam-doc.seam. Many browsers (and users) would prefer to see URLs that contain the actual PDF name like /myDocument.pdf. This capability requires some configuration. To serve PDF files, all *.pdf resources should be mapped to the Seam Servlet Filter and to the DocumentStoreServlet:
<filter>
    <filter-name>Seam Servlet Filter</filter-name>
    <filter-class>org.jboss.seam.servlet.SeamServletFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>Seam Servlet Filter</filter-name>
    <url-pattern>*.pdf</url-pattern>
</filter-mapping>

<servlet>
    <servlet-name>Document Store Servlet</servlet-name>
    <servlet-class>org.jboss.seam.pdf.DocumentStoreServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>Document Store Servlet</servlet-name>
    <url-pattern>*.pdf</url-pattern>
</servlet-mapping>
The useExtensions option on the document store component completes the functionality by instructing the document store to generate URLs with the correct filename extension for the document type being generated.
        
<components xmlns="https://jboss.com/products/seam/components"
            xmlns:pdf="https://jboss.com/products/seam/pdf">
    <pdf:documentStore useExtensions="true" />
</components>
Generated documents are stored in conversation scope and will expire when the conversation ends. At that point, references to the document will be invalid. To You can specify a default view to be shown when a document does not exist using the errorPage property of the documentStore.
        
<pdf:documentStore useExtensions="true" errorPage="/pdfMissing.seam" />

 
 
  Published under the terms of the Open Publication License Design by Interspire