01: // ConfigCommand.java
02: // $Id: ConfigCommand.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.util.ArrayDictionary;
11:
12: import org.w3c.jigsaw.http.Reply;
13: import org.w3c.jigsaw.http.Request;
14:
15: import org.w3c.jigsaw.ssi.SSIFrame;
16:
17: /**
18: * Implementation of the <code>config</code> SSI command.
19: * Used to set the <code>sizefmt</code> and <code>datefmt</code> variables,
20: * which control the output of file sizes and dates.
21: * @author Antonio Ramirez <anto@mit.edu>
22: */
23: public class ConfigCommand implements Command {
24: private final static String NAME = "config";
25:
26: public Reply execute(SSIFrame ssiframe, Request request,
27: ArrayDictionary parameters, Dictionary variables) {
28: String parName = null, parValue = null;
29:
30: for (int i = 0; i < parameters.capacity(); i++) {
31: parName = (String) parameters.keyAt(i);
32: if (parName == null)
33: continue;
34:
35: parValue = (String) parameters.elementAt(i);
36:
37: // Check to see if parameters and/or values are permissible
38: if (parName.equals("sizefmt")) {
39: if (!parValue.equalsIgnoreCase("bytes")
40: && !parValue.equalsIgnoreCase("abbrev"))
41: continue;
42: else
43: variables.put(parName, parValue.toLowerCase());
44: } else if (parName.equals("datefmt")) {
45: variables.put(parName, parValue);
46: }
47: }
48:
49: return null;
50: }
51:
52: public String getName() {
53: return NAME;
54: }
55:
56: public String getValue(Dictionary variables, String variable,
57: Request request) {
58: return "null";
59: }
60:
61: /**
62: * return true if reply can be cached.
63: * @return a boolean.
64: */
65: public boolean acceptCaching() {
66: return true;
67: }
68: }
|