annotate src/goodjava/webserver/Request.java @ 1405:546edc2df02c

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 18 Sep 2019 05:10:08 -0600
parents 27efb1fcbcb5
children fa066aaa068c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1402
27efb1fcbcb5 move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents: 1371
diff changeset
1 package goodjava.webserver;
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 import java.util.Map;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 import java.util.LinkedHashMap;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 import java.util.Collections;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 public class Request {
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 public volatile String rawHead;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 public volatile String method;
1143
3bf5190b3c77 webserver - handle GET params
Franklin Schmidt <fschmidt@gmail.com>
parents: 1137
diff changeset
11 public volatile String rawPath;
1371
4c5548a61d4f add Request.originalPath
Franklin Schmidt <fschmidt@gmail.com>
parents: 1347
diff changeset
12 public volatile String originalPath;
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 public volatile String path;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 public volatile String protocol; // only HTTP/1.1 is accepted
1237
275d1b52dbce add Request.scheme
Franklin Schmidt <fschmidt@gmail.com>
parents: 1162
diff changeset
15 public volatile String scheme;
1146
2dda3c92a473 webserver - implement cookies
Franklin Schmidt <fschmidt@gmail.com>
parents: 1144
diff changeset
16 public final Map<String,Object> headers = Collections.synchronizedMap(new LinkedHashMap<String,Object>());
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 public final Map<String,Object> parameters = Collections.synchronizedMap(new LinkedHashMap<String,Object>());
1146
2dda3c92a473 webserver - implement cookies
Franklin Schmidt <fschmidt@gmail.com>
parents: 1144
diff changeset
18 public final Map<String,String> cookies = Collections.synchronizedMap(new LinkedHashMap<String,String>());
1147
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
19 public volatile byte[] body;
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
20
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
21 public static final class MultipartFile {
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
22 public final String filename;
1259
e8020216dee7 add Luan.to_luan and fix multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1237
diff changeset
23 public final String contentType;
1147
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
24 public final Object content; // byte[] or String
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
25
1274
383f924dfe9d support multipart files in http request
Franklin Schmidt <fschmidt@gmail.com>
parents: 1259
diff changeset
26 public MultipartFile(String filename,String contentType,Object content) {
1147
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
27 this.filename = filename;
1259
e8020216dee7 add Luan.to_luan and fix multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1237
diff changeset
28 this.contentType = contentType;
1147
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
29 this.content = content;
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
30 }
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
31
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
32 public String toString() {
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
33 return "{filename="+filename+", content="+content+"}";
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
34 }
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
35 }
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 }