public class WebContext extends Object
Route logic current thread context request and response instance.
构造器和说明 |
---|
WebContext(Request request,
Response response,
io.netty.channel.ChannelHandlerContext channelHandlerContext) |
限定符和类型 | 方法和说明 |
---|---|
static Blade |
blade()
Get blade instance
|
static void |
clean() |
static String |
contextPath()
Get context path
|
static WebContext |
create(Request request,
Response response,
io.netty.channel.ChannelHandlerContext ctx) |
Optional<String> |
env(String key)
Get application environment information.
|
String |
env(String key,
String defaultValue)
Get application environment information.
|
Environment |
environment() |
static WebContext |
get()
Get current thread context WebContext instance
|
io.netty.channel.ChannelHandlerContext |
getChannelHandlerContext() |
io.netty.channel.ChannelHandlerContext |
getHandlerContext() |
Request |
getRequest() |
Response |
getResponse() |
Route |
getRoute() |
static void |
init(Blade blade,
String contextPath)
Initializes the project when it starts
|
static void |
remove() |
static Request |
request()
Get current thread context Request instance
|
static Response |
response()
Get current thread context Response instance
|
static String |
sessionKey() |
static void |
set(WebContext webContext) |
void |
setRoute(Route route) |
public Request getRequest()
public Response getResponse()
public Environment environment()
public static String sessionKey()
public Optional<String> env(String key)
key
- environment keypublic String env(String key, String defaultValue)
key
- environment keydefaultValue
- default value, if value is nullpublic io.netty.channel.ChannelHandlerContext getChannelHandlerContext()
public io.netty.channel.ChannelHandlerContext getHandlerContext()
public Route getRoute()
public void setRoute(Route route)
public static void init(Blade blade, String contextPath)
blade
- Blade instancecontextPath
- context pathpublic static WebContext get()
public static Request request()
public static Response response()
public static WebContext create(Request request, Response response, io.netty.channel.ChannelHandlerContext ctx)
public static void set(WebContext webContext)
public static void remove()
public static Blade blade()
public static String contextPath()
public static void clean()
Copyright © 2018. All rights reserved.