-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
LocalContext.java
45 lines (35 loc) · 1016 Bytes
/
LocalContext.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.blade.mvc;
import com.blade.mvc.http.HttpRequest;
import io.netty.handler.codec.http.HttpObject;
import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder;
/**
* Cache the request context of the current thread, use it for RequestHandler.
*
* @author biezhi
* @date 2018/10/15
*/
public class LocalContext {
private HttpObject msg;
private HttpRequest request;
private HttpPostRequestDecoder decoder;
public LocalContext(HttpObject msg, HttpRequest request, HttpPostRequestDecoder decoder) {
this.msg = msg;
this.request = request;
this.decoder = decoder;
}
public HttpObject msg() {
return this.msg;
}
public HttpRequest request() {
return this.request;
}
public HttpPostRequestDecoder decoder() {
return decoder;
}
public boolean hasDecoder() {
return null != decoder;
}
public void updateMsg(HttpObject msg) {
this.msg = msg;
}
}