Mercurial Hosting > luan
annotate src/goodjava/webserver/ResponseOutputStream.java @ 1630:b735ed134662
add nginx and ssl for host
author | fffilimonov |
---|---|
date | Fri, 10 Dec 2021 17:08:17 +0000 |
parents | 27efb1fcbcb5 |
children |
rev | line source |
---|---|
1402
27efb1fcbcb5
move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents:
1347
diff
changeset
|
1 package goodjava.webserver; |
1137 | 2 |
3 import java.io.ByteArrayOutputStream; | |
4 import java.io.ByteArrayInputStream; | |
5 import java.io.IOException; | |
6 | |
7 | |
8 // plenty of room for improvement | |
9 public class ResponseOutputStream extends ByteArrayOutputStream { | |
10 private final Response response; | |
11 | |
12 public ResponseOutputStream(Response response) { | |
1160 | 13 if(response==null) throw new NullPointerException(); |
1137 | 14 this.response = response; |
15 } | |
16 | |
17 @Override public void close() throws IOException { | |
18 super.close(); | |
19 int size = size(); | |
20 response.body = new Response.Body( size, new ByteArrayInputStream(buf,0,size) ); | |
21 } | |
22 } |