// SampleCommand.java
// $Id: SampleCommand.java,v 1.9 1997/06/17 13:11:27 bmahe Exp $
// (c) COPYRIGHT MIT and INRIA, 1996.
// Please first read the full copyright statement in file COPYRIGHT.html

package w3c.jigsaw.ssi ;

import java.util.*;

import w3c.www.http.HTTP ;
import w3c.util.* ;
import w3c.jigsaw.resources.* ;
import w3c.jigsaw.http.*;

public class SampleCommand extends BasicCommand {
    protected static final String NAME = "params";

    public Reply execute(SSIResource resource,
			 Request request,
			 ArrayDictionary parameters,
			 Dictionary variables)
    {
	Reply reply = resource
	    .createCommandReply(request,HTTP.OK) ;
	StringBuffer sb = new StringBuffer();
	sb.append("<ul>");
	for(int i=0;i<parameters.capacity() && parameters.keyAt(i) != null;i++) 
	    sb.append("<li>"+parameters.keyAt(i)+" = \""+
		      parameters.elementAt(i)+"\"</li>");
	sb.append("</ul>");
	reply.setContent(sb.toString());

	handleSimpleIMS(request,reply) ;
	return reply ;
    }

    public String getName()
    {
	return NAME;
    }

  public String getValue(Dictionary variables, String variable) {
    return "null";
  }

}
