KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > InitServlet


1 /* no package! */
2
3 import javax.servlet.http.*;
4 import javax.servlet.ServletException JavaDoc;
5 import de.webman.util.registry.Registry;
6 import de.webman.util.registry.RegistryException;
7 import java.io.IOException JavaDoc;
8 import java.io.PrintStream JavaDoc;
9
10 /**
11  * This is a init servlet used for triggering the configuration system. It
12  * should be called by the servlet containers on start up.
13  *
14  * @author <a HREF="mailto:gregor@webman.de">Gregor Klinke</a>
15  * @version $Revision: 1.2 $
16  **/

17 public class InitServlet
18     extends HttpServlet
19 {
20     /* $Id: InitServlet.java,v 1.2 2002/04/12 14:03:10 gregor Exp $ */
21     
22     /**
23      * initialize the servlet
24      */

25     public void init() {
26         String JavaDoc basedir = getServletContext().getRealPath("/");
27         
28         try {
29             Registry.getInstance()
30                 .setConfiguration(basedir, "WEB-INF/classes/registry.xml");
31         }
32         catch (Exception JavaDoc re) {
33             PrintStream JavaDoc stderr = System.err;
34             stderr.println(re);
35         }
36     }
37
38     /**
39      * handle GET request. this is only a fake implementation
40      * @param req request
41      * @param res response
42      * @throws ServletException ...
43      * @throws IOException ...
44      **/

45     public void doGet(HttpServletRequest req, HttpServletResponse res)
46         throws ServletException JavaDoc, IOException JavaDoc
47     {
48         /* do nothing */
49     }
50 }
51
Popular Tags