KickJava   Java API By Example, From Geeks To Geeks.

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


1 /******************************************************************************
2  * ResponderAGENTLIST.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.*;
14 import java.net.*;
15 import javax.servlet.*;
16 import javax.servlet.http.*;
17 import org.openlaszlo.compiler.*;
18 import org.openlaszlo.connection.*;
19 import org.openlaszlo.utils.*;
20 import org.apache.log4j.*;
21
22
23 public class ResponderAGENTLIST extends ResponderConnectionAgent
24 {
25     private static boolean mIsInitialized = false;
26     private static Logger mLogger = Logger.getLogger(ResponderAGENTLIST.class);
27
28     protected void respondAgent(HttpServletRequest req, HttpServletResponse res,
29                                 ConnectionGroup group) throws IOException
30     {
31         String JavaDoc users = req.getParameter("users");
32         if ( users == null || users.equals("") ) {
33             replyWithXMLStatus(res, "missing 'users' parameter", SC_MISSING_PARAMETER);
34             return;
35         }
36
37         StringBuffer JavaDoc buf = new StringBuffer JavaDoc("<list>");
38         Set set = group.list(users);
39         Iterator iter = set.iterator();
40         while (iter.hasNext()) {
41             buf.append("<user name=\"")
42                 .append((String JavaDoc)iter.next())
43                 .append("\" />");
44         }
45         buf.append("</list>");
46
47         mLogger.debug(buf.toString());
48
49         replyWithXML(res, "ok", buf.toString());
50     }
51 }
52
Popular Tags