org.springframework.web.reactive.DispatcherHandler Java Examples
The following examples show how to use
org.springframework.web.reactive.DispatcherHandler.
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: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8908")); return httpServer.newHandler(adapter).block(); }
Example #2
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9007")); return httpServer.newHandler(adapter).block(); }
Example #3
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9006")); return httpServer.newHandler(adapter).block(); }
Example #4
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8901")); return httpServer.newHandler(adapter).block(); }
Example #5
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8909")); return httpServer.newHandler(adapter).block(); }
Example #6
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8125")); return httpServer.newHandler(adapter).block(); }
Example #7
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9008")); return httpServer.newHandler(adapter).block(); }
Example #8
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8901")); return httpServer.newHandler(adapter).block(); }
Example #9
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8095")); return httpServer.newHandler(adapter).block(); }
Example #10
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("9008")); return httpServer.newHandler(adapter).block(); }
Example #11
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", Integer.valueOf("8901")); return httpServer.newHandler(adapter).block(); }
Example #12
Source File: WebTestClientBuilder.java From spring-security-reactive with Apache License 2.0 | 5 votes |
private static ApplicationContext applicationContext(WebFilter... webFilters) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); for(WebFilter filter : webFilters) { context.registerBean(WebFilter.class, () -> filter); } context.registerBean("webHandler", DispatcherHandler.class, () -> new DispatcherHandler()); context.registerBean(HandlerMapping.class, () -> RouterFunctions.toHandlerMapping(request -> Mono.just(r -> ServerResponse.ok().build()))); context.registerBean(HandlerAdapter.class, () -> new HandlerFunctionAdapter()); context.registerBean(HandlerResultHandler.class, () -> new ServerResponseResultHandler()); context.refresh(); return context; }
Example #13
Source File: Application.java From spring-security-reactive with Apache License 2.0 | 5 votes |
@Bean public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = DispatcherHandler.toHttpHandler(context); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create("localhost", port); return httpServer.newHandler(adapter).block(); }
Example #14
Source File: WebTestClientInitializerTest.java From spring-auto-restdocs with Apache License 2.0 | 5 votes |
/** * Test for method * {@link WebTestClientInitializer#prepareSnippets(ApplicationContext)}. * * @throws IOException See {@link Snippet#document(Operation)}. */ @Test public void prepareSnippets() throws IOException { // prepare: ConfigurableApplicationContext contextMock = mock( ConfigurableApplicationContext.class); ConfigurableListableBeanFactory registryMock = mock( ConfigurableListableBeanFactory.class); when(contextMock.getBeanFactory()).thenReturn(registryMock); DispatcherHandler dispatcherHandlerMock = mock(DispatcherHandler.class); when(contextMock.getBean(eq(DispatcherHandler.class))) .thenReturn(dispatcherHandlerMock); WebTestClientInitializer webTestClientInitializer = new WebTestClientInitializer(); HandlerMethod handlerMethodMock = mock(HandlerMethod.class); webTestClientInitializer.supports(handlerMethodMock); when(contextMock.getBean(eq(WebTestClientInitializer.class))) .thenReturn(webTestClientInitializer); when(contextMock.getBean(eq(ObjectMapper.class))) .thenReturn(mock(ObjectMapper.class)); when(contextMock.getBean(eq(JavadocReader.class))) .thenReturn(mock(JavadocReader.class)); when(contextMock.getBean(eq(ConstraintReader.class))) .thenReturn(mock(ConstraintReader.class)); Operation operationMock = mock(Operation.class); Map<String, Object> attributes = new HashMap<>(); when(operationMock.getAttributes()).thenReturn(attributes); // perform: Snippet snippet = WebTestClientInitializer.prepareSnippets(contextMock); snippet.document(operationMock); // verify: assertNotNull(attributes.get(HandlerMethod.class.getName())); assertEquals(handlerMethodMock, attributes.get(HandlerMethod.class.getName())); assertNotNull(attributes.get(ObjectMapper.class.getName())); assertNotNull(attributes.get(JavadocReader.class.getName())); assertNotNull(attributes.get(ConstraintReader.class.getName())); assertNotNull(attributes.get(TypeMapping.class.getName())); }
Example #15
Source File: GatewayResilience4JCircuitBreakerAutoConfiguration.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnBean(ReactiveResilience4JCircuitBreakerFactory.class) public SpringCloudCircuitBreakerResilience4JFilterFactory springCloudCircuitBreakerResilience4JFilterFactory( ReactiveResilience4JCircuitBreakerFactory reactiveCircuitBreakerFactory, ObjectProvider<DispatcherHandler> dispatcherHandler) { return new SpringCloudCircuitBreakerResilience4JFilterFactory( reactiveCircuitBreakerFactory, dispatcherHandler); }
Example #16
Source File: SpringCloudCircuitBreakerFilterFactory.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
public SpringCloudCircuitBreakerFilterFactory( ReactiveCircuitBreakerFactory reactiveCircuitBreakerFactory, ObjectProvider<DispatcherHandler> dispatcherHandlerProvider) { super(Config.class); this.reactiveCircuitBreakerFactory = reactiveCircuitBreakerFactory; this.dispatcherHandlerProvider = dispatcherHandlerProvider; }
Example #17
Source File: SpringCloudCircuitBreakerFilterFactory.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
private DispatcherHandler getDispatcherHandler() { if (dispatcherHandler == null) { dispatcherHandler = dispatcherHandlerProvider.getIfAvailable(); } return dispatcherHandler; }
Example #18
Source File: SseIntegrationTests.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
private HttpHandler createHttpHandler() { this.wac = new AnnotationConfigApplicationContext(); this.wac.register(TestConfiguration.class); this.wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(this.wac)).build(); }
Example #19
Source File: ForwardRoutingFilter.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
private DispatcherHandler getDispatcherHandler() { if (dispatcherHandler == null) { dispatcherHandler = dispatcherHandlerProvider.getIfAvailable(); } return dispatcherHandler; }
Example #20
Source File: DispatcherHandlerIntegrationTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { this.wac = new AnnotationConfigApplicationContext(); this.wac.register(TestConfiguration.class); this.wac.refresh(); DispatcherHandler webHandler = new DispatcherHandler(); webHandler.setApplicationContext(this.wac); return WebHttpHandlerBuilder.webHandler(webHandler).build(); }
Example #21
Source File: SimpleUrlHandlerMappingIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); wac.register(WebConfig.class); wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac)) .exceptionHandler(new ResponseStatusExceptionHandler()) .build(); }
Example #22
Source File: DispatcherHandlerIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { this.wac = new AnnotationConfigApplicationContext(); this.wac.register(TestConfiguration.class); this.wac.refresh(); DispatcherHandler webHandler = new DispatcherHandler(); webHandler.setApplicationContext(this.wac); return WebHttpHandlerBuilder.webHandler(webHandler).build(); }
Example #23
Source File: MultipartIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); wac.register(TestConfiguration.class); wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac)).build(); }
Example #24
Source File: SseIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { this.wac = new AnnotationConfigApplicationContext(); this.wac.register(TestConfiguration.class); this.wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(this.wac)).build(); }
Example #25
Source File: JacksonStreamingIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { this.wac = new AnnotationConfigApplicationContext(); this.wac.register(TestConfiguration.class); this.wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(this.wac)).build(); }
Example #26
Source File: DispatcherHandlerIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); wac.register(TestConfiguration.class); wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac)).build(); }
Example #27
Source File: DispatcherHandlerIntegrationTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); wac.register(TestConfiguration.class); wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac)).build(); }
Example #28
Source File: SimpleUrlHandlerMappingIntegrationTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); wac.register(WebConfig.class); wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac)) .exceptionHandler(new ResponseStatusExceptionHandler()) .build(); }
Example #29
Source File: MultipartIntegrationTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); wac.register(TestConfiguration.class); wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac)).build(); }
Example #30
Source File: SseIntegrationTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected HttpHandler createHttpHandler() { this.wac = new AnnotationConfigApplicationContext(); this.wac.register(TestConfiguration.class); this.wac.refresh(); return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(this.wac)).build(); }