vgritsenko 2004/03/03 05:09:44
Modified: java/scratchpad/webadmin/src/org/apache/xindice/webadmin
WebAdminServlet.java
Log:
Quick hack to make it compile. For now, it supports only the first database.
Revision Changes Path
1.2 +14 -13
xml-xindice/java/scratchpad/webadmin/src/org/apache/xindice/webadmin/WebAdminServlet.java
Index: WebAdminServlet.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/scratchpad/webadmin/src/org/apache/xindice/webadmin/WebAdminServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebAdminServlet.java 9 Feb 2004 16:08:31 -0000 1.1
+++ WebAdminServlet.java 3 Mar 2004 13:09:44 -0000 1.2
@@ -32,16 +32,17 @@
import org.apache.avalon.fortress.util.FortressConfig;
import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.xindice.server.XindiceServlet;
+import org.apache.xindice.core.Database;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Jan Metzner</a>
- *
+ *
*/
public class WebAdminServlet extends XindiceServlet {
-
+
protected WebAdminContainer m_container;
protected ContainerManager m_containerManager;
-
+
/**
* Initializes Servlet and creates a WebAdminContainer instance
*
@@ -49,10 +50,10 @@
*/
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
- try {
-
+ try {
+
ServletContext servletContext =
servletConfig.getServletContext();
-
+
final FortressConfig config = new FortressConfig();
config.setContainerClass(WebAdminContainer.class);
config.setContextDirectory(
servletContext.getRealPath("/") );
@@ -73,7 +74,7 @@
}
/**
- * Pass all servlet requests through to container to be handled.
+ * Pass all servlet requests through to container to be handled.
*
* @param req a HttpServletRequest instance
* @param res a HttpServletResponse instance
@@ -82,19 +83,20 @@
*/
public void service(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {
-
+
// get request path
String path = req.getPathInfo();
if(path == null) {
path = "";
}
-
+
// xmlrpc request are handled by the XindiceServlet
if(req.getMethod().equalsIgnoreCase("POST") && path.length() <
2) {
super.doPost(req, res);
} else {
- // TODO database etc. in init not here
- m_container.handleRequest(req, res, this.database);
+ // HACK Get first database and use it. Should be
changed to support multiple databases
+ String[] databases = Database.listDatabases();
+ m_container.handleRequest(req, res,
Database.getDatabase(databases[0]));
}
}
@@ -105,5 +107,4 @@
super.destroy();
ContainerUtil.dispose(m_containerManager);
}
-
}