--- /dev/null
+// ConfigCommand.java\r
+// $Id: ConfigCommand.java,v 1.1 2010/06/15 12:21:55 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.jigsaw.ssi.commands ;\r
+\r
+import java.util.Dictionary;\r
+\r
+import org.w3c.util.ArrayDictionary;\r
+\r
+import org.w3c.jigsaw.http.Reply;\r
+import org.w3c.jigsaw.http.Request;\r
+\r
+import org.w3c.jigsaw.ssi.SSIFrame;\r
+\r
+/**\r
+ * Implementation of the <code>config</code> SSI command.\r
+ * Used to set the <code>sizefmt</code> and <code>datefmt</code> variables,\r
+ * which control the output of file sizes and dates.\r
+ * @author Antonio Ramirez <anto@mit.edu>\r
+ */\r
+public class ConfigCommand implements Command {\r
+ private final static String NAME = "config" ;\r
+\r
+ public Reply execute(SSIFrame ssiframe,\r
+ Request request,\r
+ ArrayDictionary parameters,\r
+ Dictionary variables)\r
+ {\r
+ String parName = null, parValue = null ;\r
+\r
+ for(int i=0;i<parameters.capacity();i++) {\r
+ parName = (String) parameters.keyAt(i) ;\r
+ if(parName==null) continue ;\r
+\r
+ parValue = (String) parameters.elementAt(i) ;\r
+\r
+ // Check to see if parameters and/or values are permissible\r
+ if(parName.equals("sizefmt")) {\r
+ if(!parValue.equalsIgnoreCase("bytes")\r
+ && !parValue.equalsIgnoreCase("abbrev"))\r
+ continue ;\r
+ else variables.put(parName,parValue.toLowerCase()) ;\r
+ } else if(parName.equals("datefmt")) {\r
+ variables.put(parName,parValue) ;\r
+ }\r
+ }\r
+ \r
+ return null ;\r
+ }\r
+\r
+ public String getName()\r
+ {\r
+ return NAME;\r
+ }\r
+\r
+ public String getValue(Dictionary variables, String variable,\r
+ Request request) {\r
+ return "null";\r
+ }\r
+\r
+ /**\r
+ * return true if reply can be cached.\r
+ * @return a boolean.\r
+ */\r
+ public boolean acceptCaching() {\r
+ return true;\r
+ }\r
+}\r