annotate src/goodjava/webserver/Request.java @ 1643:8d751af51b9d

fix not_found_hander
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 02 Jan 2022 00:42:58 -0700
parents fa066aaa068c
children a02a75e3daa8
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;
1607
fa066aaa068c nginx caching
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
6 import goodjava.util.CaseInsensitiveMap;
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 public class Request {
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 public volatile String rawHead;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 public volatile String method;
1143
3bf5190b3c77 webserver - handle GET params
Franklin Schmidt <fschmidt@gmail.com>
parents: 1137
diff changeset
12 public volatile String rawPath;
1371
4c5548a61d4f add Request.originalPath
Franklin Schmidt <fschmidt@gmail.com>
parents: 1347
diff changeset
13 public volatile String originalPath;
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 public volatile String path;
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 public volatile String protocol; // only HTTP/1.1 is accepted
1237
275d1b52dbce add Request.scheme
Franklin Schmidt <fschmidt@gmail.com>
parents: 1162
diff changeset
16 public volatile String scheme;
1607
fa066aaa068c nginx caching
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
17 public final Map<String,Object> headers = Collections.synchronizedMap(new CaseInsensitiveMap<Object>(new LinkedHashMap<String,CaseInsensitiveMap.Value<Object>>()));
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 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
19 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
20 public volatile byte[] body;
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
21
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
22 public static final class MultipartFile {
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
23 public final String filename;
1259
e8020216dee7 add Luan.to_luan and fix multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1237
diff changeset
24 public final String contentType;
1147
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
25 public final Object content; // byte[] or String
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
26
1274
383f924dfe9d support multipart files in http request
Franklin Schmidt <fschmidt@gmail.com>
parents: 1259
diff changeset
27 public MultipartFile(String filename,String contentType,Object content) {
1147
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
28 this.filename = filename;
1259
e8020216dee7 add Luan.to_luan and fix multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1237
diff changeset
29 this.contentType = contentType;
1147
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
30 this.content = content;
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
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
33 public String toString() {
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
34 return "{filename="+filename+", content="+content+"}";
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
35 }
30d87b7d1d62 webserver - support multipart/form-data
Franklin Schmidt <fschmidt@gmail.com>
parents: 1146
diff changeset
36 }
1137
c123ee15f99b add webserver
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 }