01: // BasicCommand.java
02: // $Id: BasicCommand.java,v 1.3 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 org.w3c.jigsaw.http.Reply;
09: import org.w3c.jigsaw.http.Request;
10:
11: import org.w3c.www.http.HTTP;
12:
13: /**
14: * This class just adds some convenience functions for commands.
15: * @author Antonio Ramirez <anto@mit.edu>
16: */
17: public abstract class BasicCommand implements Command {
18: protected static final String STATE_IF_MODIFIED_SINCE = "org.w3c.jigsaw.ssi.BasicCommand.If-Modified-Since";
19:
20: protected void handleSimpleIMS(Request request, Reply reply) {
21: long ims = request.getIfModifiedSince();
22: if (ims == -1) {
23: Long IMS = (Long) request.getState(STATE_IF_MODIFIED_SINCE);
24: if (IMS != null)
25: ims = IMS.longValue();
26: }
27: if (ims != -1) {
28: reply.setStatus(HTTP.NOT_MODIFIED);
29: reply.setLastModified(ims);
30: }
31: }
32:
33: /**
34: * return true if reply can be cached.
35: * @return a boolean.
36: */
37: public boolean acceptCaching() {
38: return true;
39: }
40: }
|