KickJava   Java API By Example, From Geeks To Geeks.

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


1 /******************************************************************************
2  * ResponderERRORCOUNT.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.apache.log4j.Logger;
21
22 public final class ResponderERRORCOUNT extends ResponderAdmin
23 {
24     private static Logger mLogger = Logger.getLogger(ResponderERRORCOUNT.class);
25
26     protected void respondAdmin(HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res)
27         throws IOException
28     {
29         ServletOutputStream JavaDoc out = res.getOutputStream();
30         try {
31             res.setContentType ("text/xml");
32             // ignore the race in accessing mErrorSWFCount
33
out.println("<lps-errorcount>" + Responder.getErrorSWFCount() + "</lps-errorcount>");
34             if (req.getParameter("clear") != null) {
35                 Responder.clearErrorSWFCount();
36                 mLogger.debug("Cleared error count");
37             }
38         } finally {
39             FileUtils.close(out);
40         }
41     }
42
43     public int getMimeType()
44     {
45         return MIME_TYPE_XML;
46     }
47 }
48
Popular Tags