org.springframework.web.server.adapter.HttpWebHandlerAdapter Java Examples

The following examples show how to use org.springframework.web.server.adapter.HttpWebHandlerAdapter. 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: MultipartIntegrationTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
protected HttpHandler createHttpHandler() {
	return new HttpWebHandlerAdapter(new CheckRequestHandler());
}
 
Example #2
Source File: MultipartIntegrationTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected HttpHandler createHttpHandler() {
	return new HttpWebHandlerAdapter(new CheckRequestHandler());
}
 
Example #3
Source File: FunctionEndpointInitializer.java    From spring-cloud-function with Apache License 2.0 4 votes vote down vote up
private void registerWebFluxAutoConfiguration(GenericApplicationContext context) {
	context.registerBean(DefaultErrorWebExceptionHandler.class, () -> errorHandler(context));
	context.registerBean(WebHttpHandlerBuilder.WEB_HANDLER_BEAN_NAME, HttpWebHandlerAdapter.class,
			() -> httpHandler(context));
	context.addApplicationListener(new ServerListener(context));
}
 
Example #4
Source File: FunctionEndpointInitializer.java    From spring-cloud-function with Apache License 2.0 4 votes vote down vote up
private HttpWebHandlerAdapter httpHandler(GenericApplicationContext context) {
	return (HttpWebHandlerAdapter) RouterFunctions.toHttpHandler(context.getBean(RouterFunction.class),
			HandlerStrategies.empty().exceptionHandler(context.getBean(WebExceptionHandler.class))
					.codecs(config -> config.registerDefaults(true)).build());
}
 
Example #5
Source File: ExceptionHandlingWebHandlerTests.java    From spring-analysis-note with MIT License 3 votes vote down vote up
@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());
}
 
Example #6
Source File: ExceptionHandlingWebHandlerTests.java    From java-technology-stack with MIT License 3 votes vote down vote up
@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());
}