xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r835962 [14/14] - in /websites/staging/xmlgraphics/trunk/content: ./ batik/ commons/ fop/ fop/0.95/ fop/1.0/ fop/1.1/ fop/dev/ fop/dev/design/ fop/trunk/
Date Wed, 24 Oct 2012 04:09:13 GMT
Modified: websites/staging/xmlgraphics/trunk/content/fop/trunk/servlets.html
==============================================================================
--- websites/staging/xmlgraphics/trunk/content/fop/trunk/servlets.html (original)
+++ websites/staging/xmlgraphics/trunk/content/fop/trunk/servlets.html Wed Oct 24 04:09:09
2012
@@ -330,11 +330,11 @@ $(document).ready(function () {
       
       <div id="content" class="grid_16">
       	<!-- <div id="breadcrumb"><a href="/">Home</a>&nbsp;&raquo&nbsp;<a
href="/fop/">Fop</a>&nbsp;&raquo&nbsp;<a href="/fop/trunk/">Trunk</a></div>
-->
-      	<div class="section-content"><h1 id="apachetm-fop-servlets">Apache(tm)
FOP: Servlets</h1>
+      	<div class="section-content"><h1 id="apachewzxhzdk2-fop-servlets">Apache&trade;
FOP: Servlets</h1>
 <p><subtitle>How to use Apache&trade; FOP in a Servlet</subtitle><version>$Revision:
1298724 $</version></p>
-<h2 id="overview-wzxhzdk7wzxhzdk8">Overview  <a id="overview"></a></h2>
+<h2 id="overview-wzxhzdk8wzxhzdk9">Overview  <a id="overview"></a></h2>
 <p>This page discusses topic all around using Apache&trade; FOP in a servlet environment.</p>
-<h2 id="example-servlets-in-the-fop-distribution-wzxhzdk10wzxhzdk11">Example Servlets
in the FOP distribution  <a id="example-servlets"></a></h2>
+<h2 id="example-servlets-in-the-fop-distribution-wzxhzdk11wzxhzdk12">Example Servlets
in the FOP distribution  <a id="example-servlets"></a></h2>
 <p>In the directory {fop-dir}/src/java/org/apache/fop/servlet, you'll find a working
example of a FOP-enabled servlet.</p>
 <p>The servlet is automatically built when you build Apache FOP using the supplied
Ant script. After building the servlet, drop fop.war into the webapps directory of Apache
Tomcat (or any other web container). Then, you can use URLs like the following to generate
PDF files:</p>
 <ul>
@@ -347,9 +347,9 @@ $(document).ready(function () {
 </ul>
 <p>The source code for the servlet can be found under {fop-dir}/src/java/org/apache/fop/servlet/FopServlet.java.
 This example servlet should not be used on a public web server connected to the Internet
as it does not contain any measures to prevent Denial-of-Service-Attacks. It is provided as
an example and as a starting point for your own servlet.</p>
-<h1 id="create-your-own-servlet-wzxhzdk12wzxhzdk13">Create your own Servlet  <a
id="servlet"></a></h1>
+<h1 id="create-your-own-servlet-wzxhzdk13wzxhzdk14">Create your own Servlet  <a
id="servlet"></a></h1>
 <p>This section assumes you are familiar with <a href="embedding.html">embedding
FOP</a> .</p>
-<h2 id="a-minimal-servlet-wzxhzdk14wzxhzdk15">A minimal Servlet # <a id="minimal-servlet"></a></h2>
+<h2 id="a-minimal-servlet-wzxhzdk15wzxhzdk16">A minimal Servlet # <a id="minimal-servlet"></a></h2>
 <p>Here is a minimal code snippet to demonstrate the basics:
 private FopFactory fopFactory = FopFactory.newInstance();
 private TransformerFactory tFactory = TransformerFactory.newInstance();</p>
@@ -366,7 +366,7 @@ private TransformerFactory tFactory = Tr
         throw new ServletException(ex);
     }
 }There are numerous problems with the code snippet above. Its purpose is only to demonstrate
the basic concepts. See below for details.</p>
-<h2 id="adding-xsl-tranformation-xslt-wzxhzdk16wzxhzdk17">Adding XSL tranformation
(XSLT) # <a id="xslt"></a></h2>
+<h2 id="adding-xsl-tranformation-xslt-wzxhzdk17wzxhzdk18">Adding XSL tranformation
(XSLT) # <a id="xslt"></a></h2>
 <p>A common requirement is to transform an XML source to XSL-FO using an XSL transformation.
It is recommended to use JAXP for this task. The following snippet shows the basic code:
 private FopFactory fopFactory = FopFactory.newInstance();
 private TransformerFactory tFactory = TransformerFactory.newInstance();</p>
@@ -406,9 +406,9 @@ private TransformerFactory tFactory = Tr
 <p>The <code>Source</code> instance used above is simply an example. If
you have to read the XML from a string, supply a <code>new StreamSource(new
           StringReader(xmlstring))</code> . Constructing and reparsing an XML string
is generally less desirable than using a SAXSource if you generate your XML. You can alternatively
supply a DOMSource as well. You may also use dynamically generated XSL if you like.</p>
 <p>Because you have an explicit <code>Transformer</code> object, you can
also use it to explicitely set parameters for the transformation run.</p>
-<h3 id="custom-configuration-wzxhzdk18wzxhzdk19">Custom configuration # <a id="cfg"></a></h3>
+<h3 id="custom-configuration-wzxhzdk19wzxhzdk20">Custom configuration # <a id="cfg"></a></h3>
 <p>You can easily set up your own FOUserAgent as demonstrated on the <a href="embedding.html">Embedding
page</a> .</p>
-<h3 id="improving-performance-wzxhzdk20wzxhzdk21">Improving performance # <a id="performance"></a></h3>
+<h3 id="improving-performance-wzxhzdk21wzxhzdk22">Improving performance # <a id="performance"></a></h3>
 <p>There are several options to consider:</p>
 <ul>
 <li>
@@ -419,7 +419,7 @@ private TransformerFactory tFactory = Tr
 </li>
 </ul>
 <p>Of course, the <a href="embedding.html#performance">performance hints from
the Embedding page</a> apply here, too.</p>
-<h3 id="accessing-resources-in-your-web-application-wzxhzdk22wzxhzdk23">Accessing resources
in your web application # <a id="uriresolver"></a></h3>
+<h3 id="accessing-resources-in-your-web-application-wzxhzdk23wzxhzdk24">Accessing resources
in your web application # <a id="uriresolver"></a></h3>
 <p>Often, you will want to use resources (stylesheets, images etc.) which are bundled
with your web application. FOP provides a URIResolver implementation that lets you access
files via the Servlet's ServletContext. The class is called <code>org.apache.fop.servlet.ServletContextURIResolver</code>
.</p>
 <p>Here's how to set it up in your servlet. Instantiate a new instance in the servlet's
init() method:</p>
 <div class="codehilite"><pre><span class="sr">/** URIResolver for use by
this servlet */</span>
@@ -459,7 +459,7 @@ Source xsltSrc = this.uriResolver.resolv
     "servlet-context:/xslt/mystylesheet.xsl", null);
 Transformer transformer = this.transFactory.newTransformer(xsltSrc);
 transformer.setURIResolver(this.uriResolver);</p>
-<h1 id="notes-on-microsoft-internet-explorer-wzxhzdk24wzxhzdk25">Notes on Microsoft
Internet Explorer  <a id="ie"></a></h1>
+<h1 id="notes-on-microsoft-internet-explorer-wzxhzdk25wzxhzdk26">Notes on Microsoft
Internet Explorer  <a id="ie"></a></h1>
 <p>Some versions of Internet Explorer will not automatically show the PDF or call the
servlet multiple times. These are well-known limitations of Internet Explorer and are not
a problem of the servlet. However, Internet Explorer can still be used to download the PDF
so that it can be viewed later. Here are some suggestions in this context:</p>
 <ul>
 <li>
@@ -474,13 +474,13 @@ transformer.setURIResolver(this.uriResol
 <p>Cache in the server. It may help to include a parameter in the URL which has a timestamp
as the value min order to decide whether a request is repeated. IEx is reported to retrieve
a document up to three times, but never more often.</p>
 </li>
 </ul>
-<h2 id="servlet-engines-wzxhzdk26wzxhzdk27">Servlet Engines  <a id="servlet-engine"></a></h2>
+<h2 id="servlet-engines-wzxhzdk27wzxhzdk28">Servlet Engines  <a id="servlet-engine"></a></h2>
 <p>When using a servlet engine, there are potential CLASSPATH issues, and potential
conflicts with existing XML/XSLT libraries. Servlet containers also often use their own classloaders
for loading webapps, which can cause bugs and security problems.</p>
-<h3 id="tomcat-wzxhzdk28wzxhzdk29">Tomcat # <a id="tomcat"></a></h3>
+<h3 id="tomcat-wzxhzdk29wzxhzdk30">Tomcat # <a id="tomcat"></a></h3>
 <p>Check Tomcat's documentation for detailed instructions about installing FOP and
Cocoon. There are known bugs that must be addressed, particularly for Tomcat 4.0.3.</p>
-<h3 id="websphere-35-wzxhzdk30wzxhzdk31">WebSphere 3.5 # <a id="websphere"></a></h3>
+<h3 id="websphere-35-wzxhzdk31wzxhzdk32">WebSphere 3.5 # <a id="websphere"></a></h3>
 <p>Put a copy of a working parser in some directory where WebSphere can access it.
For example, if /usr/webapps/yourapp/servlets is the CLASSPATH for your servlets, copy the
Xerces jar into it (any other directory would also be fine). Do not add the jar to the servlet
CLASSPATH, but add it to the CLASSPATH of the application server which contains your web application.
In the WebSphere administration console, click on the "environment" button in the "general"
tab. In the "variable name" box, enter "CLASSPATH". In the "value" box, enter the correct
path to the parser jar file (/usr/webapps/yourapp/servlets/Xerces.jar in our example here).
Press "OK", then apply the change and restart the application server.</p>
-<h2 id="handling-complex-use-cases-wzxhzdk32wzxhzdk33">Handling complex use cases 
<a id="complex-usecases"></a></h2>
+<h2 id="handling-complex-use-cases-wzxhzdk33wzxhzdk34">Handling complex use cases 
<a id="complex-usecases"></a></h2>
 <p>Sometimes the requirements for a servlet get quite sophisticated: SQL data sources,
multiple XSL transformations, merging of several datasources etc. In such a case consider
using <a href="http://cocoon.apache.org/">Apache Cocoon</a> instead of a custom
servlet to accomplish your goal.</p></div>
       </div>
       



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message