01: package vicazh.hyperpool.stream.net.http;
02:
03: import java.io.*;
04: import java.util.*;
05: import java.util.logging.*;
06: import vicazh.hyperpool.Start;
07:
08: class LogStream extends ServerStream {
09: LogStream(Session session, OutputStream outputstream) {
10: super (session, outputstream);
11: }
12:
13: private Date start;
14:
15: public void head(String version, int code, String message)
16: throws IOException {
17: start = new Date();
18: super .head(version, code, message);
19: }
20:
21: long count;
22:
23: public void content(int b) throws IOException {
24: super .content(b);
25: count++;
26: }
27:
28: public void end() {
29: try {
30: ((LogService) connection.element).store(session, start);
31: } catch (FileNotFoundException e) {
32: Start.logger.log(Level.SEVERE, e.getMessage(), e);
33: }
34: super.end();
35: }
36: }
|