From 095a8359664fdd3c709fdc774ff268da27a06049 Mon Sep 17 00:00:00 2001
From: Jeremias Maerki
Date: Fri, 9 Feb 2007 09:58:24 +0000
Subject: [PATCH] Document the usage of the ServletContextURIResolver.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@505235 13f79535-47bb-0310-9956-ffa450edef68
---
.../content/xdocs/trunk/servlets.xml | 65 +++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/src/documentation/content/xdocs/trunk/servlets.xml b/src/documentation/content/xdocs/trunk/servlets.xml
index cecbcaa60..119ac701e 100644
--- a/src/documentation/content/xdocs/trunk/servlets.xml
+++ b/src/documentation/content/xdocs/trunk/servlets.xml
@@ -177,6 +177,71 @@ public void init() throws ServletException {
apply here, too.
+
+ Accessing resources in your web application
+
+ 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
+ org.apache.fop.servlet.ServletContextURIResolver.
+
+
+ Here's how to set it up in your servlet. Instantiate a new instance in the servlet's
+ init() method:
+
+
+
+ The ServletContextURIResolver reacts on URIs beginning with "servlet-context:". If you
+ want to access an image in a subdirectory of your web application, you could, for
+ example, use: "servlet-context:/images/myimage.png". Don't forget the leading slash
+ after the colon!
+
+
+ Further down, you can use the URIResolver for various things:
+
+
+
+ With the Transformer (JAXP/XSLT) so things like document() functions can resolver
+ "servlet-context:" URIs.
+
+
+ With the FopFactory so every resource FOP loads can be loaded using a "servlet-context:"
+ URI.
+
+
+ You can the ServletContextURIResolver yourself in your servlet code to access
+ stylesheets or XML files bundled with your web application.
+
+
+
+ Here are some example snippets:
+
+
+ Notes on Microsoft Internet Explorer
--
2.39.5