01: // Command.java
02: // $Id: Command.java,v 1.6 2000/08/16 21:37:46 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: * This interface is used to supply implementations of SSI
19: * commands. They have to be registered in a CommandRegistry, which in
20: * turn is used by the SSIFrame.
21: *
22: * @see org.w3c.jigsaw.ssi.commands.CommandRegistry
23: * @author Antonio Ramirez <anto@mit.edu>
24: */
25:
26: public interface Command {
27: /**
28: * Executes this command. Might modify variables.
29: * Must <em>not</em> modify the parameters.
30: * <P> It may handle conditional requests, <em>except</em> that if
31: * it replies with a status of HTTP.NOT_MODIFIED, it <em>must</em>
32: * still reply with a content (the same content that it would have
33: * returned for an inconditional request). This is because
34: * further SSI commands down the line may decide thay they have
35: * been modified, and then a content must be emitted by SSIFrame.
36: *
37: * @param request the original HTTP request
38: * @param parameters The parameters for this command
39: * @param variables The global variables for the parse
40: * @return a Reply with the output from the command */
41: public Reply execute(SSIFrame resource, Request request,
42: ArrayDictionary parameters, Dictionary variables);
43:
44: /**
45: * Returns the name of this command. <em>(Case sensitivity is up to
46: * the <code>lookupCommand</code> method in the command registry.)</em>
47: *
48: * @return the name of the command
49: * @see org.w3c.jigsaw.ssi.commands.CommandRegistry#lookupCommand
50: */
51:
52: public String getName();
53:
54: /**
55: * Returns the (String) value of the given variable.
56: * @return a String instance.
57: */
58: public String getValue(Dictionary variables, String variable,
59: Request request);
60:
61: /**
62: * return true if reply can be cached.
63: * @return a boolean.
64: */
65: public boolean acceptCaching();
66:
67: }
|