org.tio.http.server.handler.DefaultHttpRequestHandler Java Examples
The following examples show how to use
org.tio.http.server.handler.DefaultHttpRequestHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TioBenchmarkStarter.java From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @param args * @author tanyaowu * @throws IOException */ public static void main(String[] args) throws Exception { httpConfig = new HttpConfig(8080, null, null, null); httpConfig.setUseSession(false); httpConfig.setWelcomeFile(null); httpConfig.setCheckHost(false); httpConfig.setCompatible1_0(false); Routes routes = new Routes(TestController.class); requestHandler = new DefaultHttpRequestHandler(httpConfig, routes); requestHandler.setCompatibilityAssignment(false); httpServerStarter = new HttpServerStarter(httpConfig, requestHandler); serverTioConfig = httpServerStarter.getServerTioConfig(); serverTioConfig.statOn = false; httpServerStarter.start(); }
Example #2
Source File: TioWebServerBootstrap.java From tio-starters with MIT License | 5 votes |
private void initRequestHandler() throws Exception { httpRequestHandler = new DefaultHttpRequestHandler(this.httpConfig, this.routes); //httpRequestHandler.setHttpServerInterceptor(WebApiHttpServerInterceptor.ME); //httpRequestHandler.setHttpSessionListener(WebApiHttpSessionListener.ME); // httpRequestHandler.setSessionCookieDecorator(new SessionCookieDecorator() { // @Override // public void decorate(Cookie sessionCookie, HttpRequest request, String domain) { // // } // }); // httpRequestHandler.setThrowableHandler(new ThrowableHandler() { // @Override // public HttpResponse handler(HttpRequest request, RequestLine requestLine, Throwable throwable) throws Exception { // return null; // } // }); //httpRequestHandler.setIpPathAccessStats(null); //IpPathAccessStats ipPathAccessStats = new IpPathAccessStats(TioSiteStatPathFilter.me, serverTioConfig, TioSiteIpPathAccessStatListener.ME_SITE_API, // Const.IpPathAccessStatDuration.IP_PATH_ACCESS_STAT_DURATIONS); //httpRequestHandler.setIpPathAccessStats(ipPathAccessStats); //TokenPathAccessStats tokenPathAccessStats = new TokenPathAccessStats(TioSiteStatPathFilter.me, TioSiteTokenGetter.me, TioSiteCurrUseridGetter.me, serverTioConfig, // TioSiteTokenPathAccessStatListener.ME_SITE_API, TokenPathAccessStatDuration.TOKEN_PATH_ACCESS_STAT_DURATIONS); //httpRequestHandler.setTokenPathAccessStats(tokenPathAccessStats); if (tioWebServerListener != null) { tioWebServerListener.afterSetHttpRequestHandler(this.httpRequestHandler); } }
Example #3
Source File: DefaultTokenGetter.java From t-io with Apache License 2.0 | 5 votes |
@Override public String getToken(HttpRequest request) { // HttpSession httpSession = request.getHttpSession(); // if (httpSession != null) { // return httpSession.getId(); // } // Cookie cookie = DefaultHttpRequestHandler.getSessionCookie(request, request.httpConfig); // if (cookie != null) { // log.error("token from cookie: {}", cookie.getValue()); // return cookie.getValue(); // } return DefaultHttpRequestHandler.getSessionId(request); }