public class DefaultHttpRequestHandler extends Object implements IHttpRequestHandler
Modifier and Type | Field and Description |
---|---|
protected HttpConfig |
httpConfig |
protected Routes |
routes |
Constructor and Description |
---|
DefaultHttpRequestHandler(HttpConfig httpConfig) |
DefaultHttpRequestHandler(HttpConfig httpConfig,
Routes routes) |
Modifier and Type | Method and Description |
---|---|
void |
clearStaticResCache(HttpRequest request)
清空静态资源缓存,如果没有缓存,可以不处理
|
HttpConfig |
getHttpConfig() |
IHttpServerListener |
getHttpServerListener() |
org.tio.utils.cache.guava.GuavaCache |
getStaticResCache() |
HttpResponse |
handler(HttpRequest request,
RequestLine requestLine) |
static void |
main(String[] args) |
HttpResponse |
resp404(HttpRequest request,
RequestLine requestLine) |
HttpResponse |
resp500(HttpRequest request,
RequestLine requestLine,
Throwable throwable) |
void |
setHttpConfig(HttpConfig httpConfig) |
void |
setHttpServerListener(IHttpServerListener httpServerListener) |
void |
setStaticResCache(org.tio.utils.cache.guava.GuavaCache staticResCache) |
protected HttpConfig httpConfig
protected Routes routes
public DefaultHttpRequestHandler(HttpConfig httpConfig)
httpConfig
- public DefaultHttpRequestHandler(HttpConfig httpConfig, Routes routes)
httpConfig
- routes
- public static void main(String[] args)
args
- public HttpConfig getHttpConfig()
public IHttpServerListener getHttpServerListener()
public org.tio.utils.cache.guava.GuavaCache getStaticResCache()
public HttpResponse handler(HttpRequest request, RequestLine requestLine) throws Exception
handler
in interface IHttpRequestHandler
Exception
public HttpResponse resp404(HttpRequest request, RequestLine requestLine)
resp404
in interface IHttpRequestHandler
public HttpResponse resp500(HttpRequest request, RequestLine requestLine, Throwable throwable)
resp500
in interface IHttpRequestHandler
public void setHttpConfig(HttpConfig httpConfig)
httpConfig
- the httpConfig to setpublic void setHttpServerListener(IHttpServerListener httpServerListener)
public void setStaticResCache(org.tio.utils.cache.guava.GuavaCache staticResCache)
staticResCache
- the staticResCache to setpublic void clearStaticResCache(HttpRequest request)
IHttpRequestHandler
clearStaticResCache
in interface IHttpRequestHandler
Copyright © 2018. All rights reserved.