01: // HttpConnection.java
02: // $Id: HttpConnection.java,v 1.13 2004/03/11 15:11:04 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.www.protocol.http;
07:
08: import org.w3c.util.LRUAble;
09:
10: abstract class HttpConnection implements LRUAble {
11: // LRUAble interface implementation.
12: protected LRUAble lru_next = null;
13: protected LRUAble lru_prev = null;
14: /**
15: * The server this connection is attached to.
16: */
17: protected HttpServer server = null;
18:
19: /**
20: * state if the connection was cached or not.
21: */
22: protected boolean cached = false;
23:
24: /**
25: * LRUAble interface - Get previous item in the LRU list.
26: * @return The previous item, or <strong>null</strong>.
27: */
28:
29: public LRUAble getNext() {
30: return lru_next;
31: }
32:
33: /**
34: * LRUAble interface - Get next item in the LRU list.
35: * @return The next item, or <strong>null</strong>.
36: */
37:
38: public LRUAble getPrev() {
39: return lru_prev;
40: }
41:
42: /**
43: * LRUAble interface - Set the next item for this server.
44: */
45:
46: public void setNext(LRUAble next) {
47: lru_next = next;
48: }
49:
50: /**
51: * LRUAble interface - Set the previous item for this server.
52: */
53:
54: public void setPrev(LRUAble prev) {
55: lru_prev = prev;
56: }
57:
58: protected final HttpServer getServer() {
59: return server;
60: }
61:
62: abstract public void close();
63:
64: /**
65: * Can this connection be reused as a first choice when requested?
66: * This is only a hint, as if all connections fail, the first one will
67: * be forced by default
68: * @return a boolean, true by default
69: */
70: protected boolean mayReuse() {
71: return true;
72: }
73: }
|