KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > servlets > responders > ResponderCLEARLOG


1 /******************************************************************************
2  * ResponderCLEARLOG.java
3  * ****************************************************************************/

4
5 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
6 * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
7 * Use is subject to license terms. *
8 * J_LZ_COPYRIGHT_END *********************************************************/

9
10 package org.openlaszlo.servlets.responders;
11
12 import java.io.*;
13 import java.util.Properties JavaDoc;
14 import javax.servlet.ServletConfig JavaDoc;
15 import javax.servlet.ServletException JavaDoc;
16 import javax.servlet.ServletOutputStream JavaDoc;
17 import javax.servlet.http.HttpServletRequest JavaDoc;
18 import javax.servlet.http.HttpServletResponse JavaDoc;
19 import org.openlaszlo.utils.FileUtils;
20 import org.openlaszlo.server.LPS;
21 import org.apache.log4j.Logger;
22
23 public final class ResponderCLEARLOG extends ResponderAdmin
24 {
25     private static Logger mLogger = Logger.getLogger(ResponderCLEARLOG.class);
26
27     protected void respondAdmin(HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res)
28         throws IOException
29     {
30         String JavaDoc[] status = new String JavaDoc[1];
31         status[0] = "";
32
33         boolean cleared = ResponderLOGCONFIG.clearLog(status);
34
35         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
36         buf.append("<clearlog ")
37             .append("cleared=\"").append(cleared).append("\" ");
38         if (status[0].intern() != "") {
39             buf.append("status=\"").append(status[0]).append("\" ");
40         }
41         buf.append(" />");
42
43         respondWithXML(res, buf.toString());
44
45         if (cleared)
46             mLogger.info("Cleared log.");
47         else
48             mLogger.info("Could not clear log.");
49
50     }
51
52     public int getMimeType()
53     {
54         return MIME_TYPE_XML;
55     }
56 }
57
Popular Tags