01: /******************************************************************************
02: * ResponderAGENTLIST.java
03: * ****************************************************************************/package org.openlaszlo.servlets.responders;
04:
05: import java.io.*;
06: import java.util.*;
07: import java.net.*;
08: import javax.servlet.*;
09: import javax.servlet.http.*;
10: import org.openlaszlo.compiler.*;
11: import org.openlaszlo.connection.*;
12: import org.openlaszlo.utils.*;
13: import org.apache.log4j.*;
14:
15: public class ResponderAGENTLIST extends ResponderConnectionAgent {
16: private static boolean mIsInitialized = false;
17: private static Logger mLogger = Logger
18: .getLogger(ResponderAGENTLIST.class);
19:
20: protected void respondAgent(HttpServletRequest req,
21: HttpServletResponse res, ConnectionGroup group)
22: throws IOException {
23: String users = req.getParameter("users");
24: if (users == null || users.equals("")) {
25: replyWithXMLStatus(res, "missing 'users' parameter",
26: SC_MISSING_PARAMETER);
27: return;
28: }
29:
30: StringBuffer buf = new StringBuffer("<list>");
31: Set set = group.list(users);
32: Iterator iter = set.iterator();
33: while (iter.hasNext()) {
34: buf.append("<user name=\"").append((String) iter.next())
35: .append("\" />");
36: }
37: buf.append("</list>");
38:
39: mLogger.debug(buf.toString());
40:
41: replyWithXML(res, "ok", buf.toString());
42: }
43: }
|