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,
LocalContext localContext) |
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() |
LocalContext |
getLocalContext() |
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 void |
set(WebContext webContext) |
void |
setLocalContext(LocalContext localContext) |
void |
setRoute(Route route) |
public static WebContext get()
public static Request request()
public static Response response()
public static WebContext create(Request request, Response response, io.netty.channel.ChannelHandlerContext ctx, LocalContext localContext)
public static void set(WebContext webContext)
public static void remove()
public Request getRequest()
public Response getResponse()
public static void init(Blade blade, String contextPath)
blade
- Blade instancecontextPath
- context pathpublic static Blade blade()
public static String contextPath()
public static void clean()
public Environment environment()
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 LocalContext getLocalContext()
public Route getRoute()
public void setLocalContext(LocalContext localContext)
public void setRoute(Route route)
Copyright © 2018. All rights reserved.