01: // SampleCommand.java
02: // $Id: SampleCommand.java,v 1.4 2000/08/16 21:37:47 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1996.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigsaw.ssi.commands;
07:
08: import java.util.Dictionary;
09:
10: import org.w3c.www.http.HTTP;
11:
12: import org.w3c.util.ArrayDictionary;
13:
14: import org.w3c.jigsaw.http.Reply;
15: import org.w3c.jigsaw.http.Request;
16:
17: import org.w3c.jigsaw.ssi.SSIFrame;
18:
19: public class SampleCommand extends BasicCommand {
20: protected static final String NAME = "params";
21:
22: public Reply execute(SSIFrame ssiframe, Request request,
23: ArrayDictionary parameters, Dictionary variables) {
24: Reply reply = ssiframe.createCommandReply(request, HTTP.OK);
25: StringBuffer sb = new StringBuffer();
26: sb.append("<ul>");
27: for (int i = 0; i < parameters.capacity()
28: && parameters.keyAt(i) != null; i++)
29: sb.append("<li>" + parameters.keyAt(i) + " = \""
30: + parameters.elementAt(i) + "\"</li>");
31: sb.append("</ul>");
32: reply.setContent(sb.toString());
33:
34: handleSimpleIMS(request, reply);
35: return reply;
36: }
37:
38: public String getName() {
39: return NAME;
40: }
41:
42: public String getValue(Dictionary variables, String variable,
43: Request request) {
44: return "null";
45: }
46:
47: }
|