@Override protected HttpHandler createHttpHandler() { return new HttpWebHandlerAdapter(new CheckRequestHandler()); }
/** * Build the {@link HttpHandler}. */ public HttpHandler build() { WebHandler decorated = new FilteringWebHandler(this.webHandler, this.filters); decorated = new ExceptionHandlingWebHandler(decorated, this.exceptionHandlers); HttpWebHandlerAdapter adapted = new HttpWebHandlerAdapter(decorated); if (this.sessionManager != null) { adapted.setSessionManager(this.sessionManager); } if (this.codecConfigurer != null) { adapted.setCodecConfigurer(this.codecConfigurer); } if (this.localeContextResolver != null) { adapted.setLocaleContextResolver(this.localeContextResolver); } if (this.forwardedHeaderTransformer != null) { adapted.setForwardedHeaderTransformer(this.forwardedHeaderTransformer); } if (this.applicationContext != null) { adapted.setApplicationContext(this.applicationContext); } adapted.afterPropertiesSet(); return adapted; }
@Test public void unresolvedExceptionWithWebHttpHandlerAdapter() throws Exception { // HttpWebHandlerAdapter handles unresolved errors new HttpWebHandlerAdapter(createWebHandler(new UnresolvedExceptionHandler())) .handle(this.exchange.getRequest(), this.exchange.getResponse()).block(); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, this.exchange.getResponse().getStatusCode()); }
/** * Build the {@link HttpHandler}. */ public HttpHandler build() { WebHandler decorated = new FilteringWebHandler(this.webHandler, this.filters); decorated = new ExceptionHandlingWebHandler(decorated, this.exceptionHandlers); HttpWebHandlerAdapter adapted = new HttpWebHandlerAdapter(decorated); if (this.sessionManager != null) { adapted.setSessionManager(this.sessionManager); } if (this.codecConfigurer != null) { adapted.setCodecConfigurer(this.codecConfigurer); } if (this.localeContextResolver != null) { adapted.setLocaleContextResolver(this.localeContextResolver); } if (this.forwardedHeaderTransformer != null) { adapted.setForwardedHeaderTransformer(this.forwardedHeaderTransformer); } if (this.applicationContext != null) { adapted.setApplicationContext(this.applicationContext); } adapted.afterPropertiesSet(); return adapted; }
/** * Create a {@link ServletHttpHandlerAdapter}. * <p>Default implementation returns a {@code ServletHttpHandlerAdapter} with the provided * {@code webHandler}. */ protected ServletHttpHandlerAdapter createHandlerAdapter(WebHandler webHandler) { HttpHandler httpHandler = new HttpWebHandlerAdapter(webHandler); return new ServletHttpHandlerAdapter(httpHandler); }
/** * Build the {@link HttpHandler}. */ public HttpHandler build() { WebHandler decorated = new FilteringWebHandler(this.webHandler, this.filters); decorated = new ExceptionHandlingWebHandler(decorated, this.exceptionHandlers); HttpWebHandlerAdapter adapted = new HttpWebHandlerAdapter(decorated); if (this.sessionManager != null) { adapted.setSessionManager(this.sessionManager); } if (this.codecConfigurer != null) { adapted.setCodecConfigurer(this.codecConfigurer); } if (this.localeContextResolver != null) { adapted.setLocaleContextResolver(this.localeContextResolver); } if (this.applicationContext != null) { adapted.setApplicationContext(this.applicationContext); } return adapted; }
Assert.notNull(strategies, "HandlerStrategies must not be null"); return new HttpWebHandlerAdapter(exchange -> { ServerRequest request = new DefaultServerRequest(exchange, strategies); addAttributes(exchange, request);
/** * Build the {@link HttpHandler}. */ public HttpHandler build() { WebHandler decorated = new FilteringWebHandler(this.webHandler, this.filters); decorated = new ExceptionHandlingWebHandler(decorated, this.exceptionHandlers); HttpWebHandlerAdapter adapted = new HttpWebHandlerAdapter(decorated); if (this.sessionManager != null) { adapted.setSessionManager(this.sessionManager); } if (this.codecConfigurer != null) { adapted.setCodecConfigurer(this.codecConfigurer); } if (this.localeContextResolver != null) { adapted.setLocaleContextResolver(this.localeContextResolver); } if (this.forwardedHeaderTransformer != null) { adapted.setForwardedHeaderTransformer(this.forwardedHeaderTransformer); } if (this.applicationContext != null) { adapted.setApplicationContext(this.applicationContext); } adapted.afterPropertiesSet(); return adapted; }