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