vgritsenko 2004/01/15 05:50:28
Modified: config web.xml
java/src/org/apache/xindice/server XindiceServlet.java
Log:
Allow absolute file path to the configuration file
Revision Changes Path
1.9 +14 -2 xml-xindice/config/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/xml-xindice/config/web.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- web.xml 30 Dec 2003 13:07:38 -0000 1.8
+++ web.xml 15 Jan 2004 13:50:28 -0000 1.9
@@ -3,22 +3,34 @@
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<!--
+ - Xindice Server WebApp Configuration File
+ -
- Version: $Revision$ $Date$
- Authors: Kimbro Staken ([EMAIL PROTECTED])
- Vladimir R. Bossicard ([EMAIL PROTECTED])
-->
+
<web-app>
<display-name>Apache Xindice</display-name>
<description>Apache Xindice XMLRPC Server</description>
<servlet>
<servlet-name>xindice</servlet-name>
<servlet-class>org.apache.xindice.server.XindiceServlet</servlet-class>
+
+ <!--
+ - This parameter should point to the Xindice Server configuration
+ - file. Relative paths resolved relative to webapp context root and
+ - must point to the resource within context. Absolute paths
+ - (starting with '/') loaded from the file system.
+ -->
<init-param>
<param-name>xindice.configuration</param-name>
- <param-value>/WEB-INF/system.xml</param-value>
+ <param-value>WEB-INF/system.xml</param-value>
</init-param>
+
<load-on-startup>1</load-on-startup>
</servlet>
+
<servlet-mapping>
<servlet-name>xindice</servlet-name>
<url-pattern>/*</url-pattern>
1.28 +15 -5
xml-xindice/java/src/org/apache/xindice/server/XindiceServlet.java
Index: XindiceServlet.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/server/XindiceServlet.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- XindiceServlet.java 24 Dec 2003 14:17:41 -0000 1.27
+++ XindiceServlet.java 15 Jan 2004 13:50:28 -0000 1.28
@@ -78,6 +78,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -262,9 +263,18 @@
String path =
servletConfig.getInitParameter(Xindice.PROP_XINDICE_CONFIGURATION);
if (path != null) {
- log.debug("Loading configuration from " + path);
- ServletContext context = servletConfig.getServletContext();
- InputStream inputStream = context.getResourceAsStream(path);
+ InputStream inputStream = null;
+ if (path.startsWith("/")) {
+ // Absolute file path
+ log.debug("Loading configuration from filesystem path "
+ path);
+ inputStream = new FileInputStream(path);
+ } else {
+ // Relative (to the context) path
+ log.debug("Loading configuration from context path " +
path);
+ ServletContext context =
servletConfig.getServletContext();
+ inputStream = context.getResourceAsStream(path);
+ }
+
try {
configurationDocument =
DOMParser.toDocument(inputStream);
} finally {