Skip to content

Commit a75f523

Browse files
committed
update README.md
1 parent 8545451 commit a75f523

File tree

7 files changed

+46
-12
lines changed

7 files changed

+46
-12
lines changed

README.md

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
- [x] 语言
1111
- [x] 程序运行方式
12-
- [ ] 功能点
13-
- [ ] 说明、运行截图
12+
- [x] 功能点
13+
- [x] 说明、运行截图
1414
- [ ] 关键数据结构、类说明
1515
- [ ] 名字与对应功能
1616

@@ -204,19 +204,18 @@ CLIENT: Request complete
204204

205205
# 3. 功能
206206

207-
## 3.1 HttpServer
207+
HttpServer 与 HttpClient 均采用 Java NIO.2 模型进行开发,使用了 `java.nio.channels.AsynchronousServerSocketChannel``java.nio.channels.AsynchronousSocketChannel` 等类。
208208

209-
HttpServer 采用 Java NIO.2 模型进行开发,使用了 `java.nio.channels.AsynchronousServerSocketChannel``java.nio.channels.AsynchronousSocketChannel` 等类。
209+
## 3.1 HttpServer
210210

211-
### 3.1.1 接收
212211

213-
#### 3.1.1.1 支持 `GET``POST` 请求
212+
### 3.1.1 支持 `GET``POST` 请求
214213

215214
相关测试: [LoginSystemTests](./src/test/java/loginsystemtests/LoginSystemTests.java)
216215

217216
<img src="./docs/image/feature_get.png" alt="GET" width="300"> <img src="./docs/image/feature_post.png" alt="POST" width="300">
218217

219-
#### 3.1.1.2 支持以下状态码:
218+
### 3.1.2 支持以下状态码:
220219

221220
- 200 OK<br/>
222221
<img src="./docs/image/feature_status_200.png" alt="200" width="300">
@@ -242,12 +241,12 @@ HttpServer 采用 Java NIO.2 模型进行开发,使用了 `java.nio.channels.A
242241
- 505 HTTP Version Not Supported<br/>
243242
<img src="./docs/image/feature_status_505.png" alt="505" width="300">
244243

245-
#### 3.1.1.3 支持长连接 (Keep-Alive)
244+
### 3.1.3 支持长连接 (Keep-Alive)
246245

247246
相关测试:[KeepAliveTest](./src/test/java/servertests/KeepAliveTest.java)
248247

249248
<img src="./docs/image/feature_keep_alive.png" alt="Keep-Alive">
250-
#### 3.1.1.4 支持MIME类型:
249+
### 3.1.4 支持MIME类型:
251250

252251
已测试过的全部类型: [mime.json](./src/main/resources/mime.json)
253252

@@ -265,7 +264,7 @@ HttpServer 采用 Java NIO.2 模型进行开发,使用了 `java.nio.channels.A
265264
- svg: `image/svg+xml`<br/>
266265
<img src="./docs/image/feature_mime_svg.png" alt="SVG" width="500">
267266

268-
#### 3.1.1.5 支持注册、登录、状态保持系统
267+
### 3.1.5 支持注册、登录、状态保持系统
269268

270269
相关测试: [LoginSystemTests](./src/test/java/loginsystemtests/LoginSystemTests.java)
271270

@@ -285,3 +284,39 @@ HttpServer 采用 Java NIO.2 模型进行开发,使用了 `java.nio.channels.A
285284
<img src="./docs/image/feature_loginsys_5.png" alt="loginsys_5" width="500">
286285

287286
## 3.2 HttpClient
287+
288+
### 3.2.1 在CLI界面显示 Http Request&Response Message
289+
290+
相关测试:[WANTest](./src/test/java/clienttests/WANTest.java)
291+
292+
<img src="./docs/image/feature_client_cli.png" alt="client_cli">
293+
294+
### 3.2.2 对 Status code 301, 302, 304 的处理
295+
296+
相关测试:[RequestTest](./src/test/java/clienttests/RequestTest.java)
297+
298+
1. 301 Moved<br/>
299+
<img src="./docs/image/feature_client_301.png" alt="301">
300+
301+
2. 302 Found<br/>
302+
<img src="./docs/image/feature_client_302.png" alt="302">
303+
304+
3. 304 Not Modified<br/>
305+
<img src="./docs/image/feature_client_304.png" alt="304">
306+
307+
308+
### 3.3 其他
309+
310+
- 仅支持 HTTP/1.1
311+
- 收/发支持的 Content-Encoding: gzip
312+
- 收/发支持的 Transfer-Encoding: default(Content-Length), chunked
313+
- HttpServer 可以自动根据负载大小调整选用的 Content-Encoding 与 Transfer-Encoding
314+
- [MessagePacker.java](./src/main/java/edu/nju/http/message/packer/MessagePacker.java)
315+
- HttpServer 可以用类似 SpringBoot 的方式编写 URL Mapping
316+
- [Target Handler](./src/main/java/edu/nju/http/server/TargetHandler.java)
317+
- [Mapping Annotation](./src/main/java/edu/nju/http/server/target/Mapping.java)
318+
- [target_path.json](./src/main/resources/target_path.json)
319+
- [Target Set](./src/main/java/edu/nju/http/server/target/TargetSet.java)
320+
321+
322+
# 4. 源码结构

docs/image/feature_client_301.png

1.05 MB
Loading

docs/image/feature_client_302.png

1.02 MB
Loading

docs/image/feature_client_304.png

1.04 MB
Loading

docs/image/feature_client_cli.png

534 KB
Loading

src/main/java/edu/nju/http/server/target/Common.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static HttpResponseMessage moved(HttpRequestMessage msg) {
3232

3333
@Mapping(value = "/found", method = WebMethods.GET)
3434
public static HttpResponseMessage found(HttpRequestMessage msg) {
35-
return factory.produce(302, "/found");
35+
return factory.produce(302, "/test");
3636
}
3737

3838
@Mapping(value = "/panic", method = WebMethods.GET)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"Connection": "keep-alive",
32
"Server": "nju_ic"
43
}

0 commit comments

Comments
 (0)