01: package vicazh.hyperpool.stream.net.http;
02:
03: import java.io.*;
04:
05: /**
06: * This class is the superclass of all sessions
07: *
08: * @author Victor Zhigunov
09: * @version 0.4.0
10: */
11: public class Session {
12: public Session() {
13: }
14:
15: private ClientStream client;
16:
17: /**
18: * Set the client data
19: */
20: public void setClient(ClientStream client) {
21: this .client = client;
22: }
23:
24: /**
25: * Get the client data
26: */
27: public ClientStream getClient() {
28: return client;
29: }
30:
31: private ServerStream server;
32:
33: /**
34: * Set the server data
35: */
36: public void setServer(ServerStream server) {
37: this .server = server;
38: }
39:
40: /**
41: * Get the server data
42: */
43: public ServerStream getServer() {
44: return server;
45: }
46:
47: /**
48: * The parent connection
49: */
50: public Connection connection;
51:
52: /**
53: * @param connection
54: * parent connection
55: */
56: public Session(Connection connection) {
57: this .connection = connection;
58: }
59:
60: /**
61: * Set client stream
62: *
63: * @param outputstream
64: * next element client stream
65: */
66: public void setClient(OutputStream outputstream) throws IOException {
67: setClient(new ClientStream(this , outputstream));
68: }
69:
70: /**
71: * Set server stream
72: *
73: * @param outputstream
74: * previous element server stream
75: */
76: public void setServer(OutputStream outputstream) throws IOException {
77: setServer(new ServerStream(this , outputstream));
78: }
79:
80: /**
81: * Close this session
82: */
83: public void close() {
84: connection.remove(this);
85: }
86: }
|