KickJava   Java API By Example, From Geeks To Geeks.

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


1 /******************************************************************************
2  * ResponderXMLRPCINFO.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 javax.servlet.http.HttpServletRequest JavaDoc;
14 import javax.servlet.http.HttpServletResponse JavaDoc;
15 import javax.servlet.ServletOutputStream JavaDoc;
16 import org.openlaszlo.data.XMLRPCDataSource;
17 import org.openlaszlo.utils.FileUtils;
18 import org.apache.log4j.Logger;
19
20 public final class ResponderXMLRPCINFO extends ResponderAdmin
21 {
22     private static Logger mLogger = Logger.getLogger(ResponderXMLRPCINFO.class);
23
24     boolean ok(String JavaDoc opt) {
25         return opt != null && opt.equals("1");
26     }
27
28     /**
29      * Get XML-RPC load information.
30      */

31     protected void respondAdmin(HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res)
32         throws IOException {
33         res.setContentType ("text/xml");
34         ServletOutputStream JavaDoc out = res.getOutputStream();
35         try {
36             if (ok(req.getParameter("clear"))) {
37                 XMLRPCDataSource.clearLoadInfo();
38             }
39             StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
40             XMLRPCDataSource.toXML(sb);
41             out.println(sb.toString());
42         } finally {
43             FileUtils.close(out);
44         }
45     }
46
47     public int getMimeType()
48     {
49         return MIME_TYPE_XML;
50     }
51 }
52
Popular Tags