01: /******************************************************************************
02: * ResponderCONNECTIONINFO.java
03: * ****************************************************************************/package org.openlaszlo.servlets.responders;
04:
05: import java.io.*;
06: import javax.servlet.*;
07: import javax.servlet.http.*;
08: import org.openlaszlo.connection.*;
09: import org.openlaszlo.utils.*;
10: import org.apache.log4j.Logger;
11:
12: public class ResponderCONNECTIONINFO extends ResponderAdmin {
13: private static Logger mLogger = Logger
14: .getLogger(ResponderCONNECTIONINFO.class);
15:
16: protected void respondAdmin(HttpServletRequest req,
17: HttpServletResponse res) throws IOException {
18: res.setContentType("text/xml");
19: StringBuffer buf = new StringBuffer();
20:
21: String _details = req.getParameter("details");
22: boolean details = (_details != null && _details.equals("1"));
23:
24: ConnectionGroup.dumpGroupsXML(buf, details);
25:
26: String appName = req.getParameter("application");
27: if (appName != null && !appName.equals("")) {
28: if (appName.equals("*")) {
29: Application.dumpApplicationsXML(buf, details);
30: } else {
31: Application application = Application.getApplication(
32: appName, false);
33: if (application != null)
34: application.toString();
35: }
36: }
37:
38: ConnectionAgent.dumpAgentsXML(buf, details);
39:
40: ServletOutputStream out = res.getOutputStream();
41: try {
42: out.println("<connection-info " + " max-message-length=\""
43: + HTTPConnection.getMaxMessageLen() + "\""
44: + " connection-length=\""
45: + HTTPConnection.getConnectionLength() + "\""
46: + " reconnection-wait-interval=\""
47: + HTTPConnection.getReconnectionWaitInterval()
48: + "\"" + " >");
49: out.println(buf.toString());
50: out.println("</connection-info>");
51: } finally {
52: FileUtils.close(out);
53: }
54: }
55:
56: public void printApplications(ServletOutputStream out)
57: throws IOException {
58: out.println("<application-list>");
59: out.println("</application-list>");
60: }
61:
62: public int getMimeType() {
63: return MIME_TYPE_XML;
64: }
65:
66: }
|