KickJava   Java API By Example, From Geeks To Geeks.

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


1 /******************************************************************************
2  * ResponderCONNECTIONINFO.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.*;
14 import javax.servlet.http.*;
15 import org.openlaszlo.connection.*;
16 import org.openlaszlo.utils.*;
17 import org.apache.log4j.Logger;
18
19 public class ResponderCONNECTIONINFO extends ResponderAdmin
20 {
21     private static Logger mLogger =
22         Logger.getLogger(ResponderCONNECTIONINFO.class);
23
24     protected void respondAdmin(HttpServletRequest req, HttpServletResponse res)
25         throws IOException
26     {
27         res.setContentType("text/xml");
28         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
29
30         String JavaDoc _details = req.getParameter("details");
31         boolean details = (_details != null && _details.equals("1"));
32
33         ConnectionGroup.dumpGroupsXML(buf, details);
34
35         String JavaDoc appName = req.getParameter("application");
36         if (appName != null && ! appName.equals("")) {
37             if (appName.equals("*")) {
38                 Application.dumpApplicationsXML(buf, details);
39             } else {
40                 Application application =
41                     Application.getApplication(appName, false);
42                 if (application != null)
43                     application.toString();
44             }
45         }
46
47         ConnectionAgent.dumpAgentsXML(buf, details);
48
49         ServletOutputStream out = res.getOutputStream();
50         try {
51             out.println("<connection-info " +
52                         " max-message-length=\"" + HTTPConnection.getMaxMessageLen() + "\"" +
53                         " connection-length=\"" + HTTPConnection.getConnectionLength() + "\"" +
54                         " reconnection-wait-interval=\"" + HTTPConnection.getReconnectionWaitInterval() + "\"" +
55                         " >");
56             out.println(buf.toString());
57             out.println("</connection-info>");
58         } finally {
59             FileUtils.close(out);
60         }
61     }
62
63         
64
65
66     public void printApplications(ServletOutputStream out)
67         throws IOException
68     {
69         out.println("<application-list>");
70         out.println("</application-list>");
71     }
72
73     public int getMimeType()
74     {
75         return MIME_TYPE_XML;
76     }
77
78 }
79
Popular Tags