Search in sources :

Example 1 with UndertowHttpServer

use of org.springframework.http.server.reactive.bootstrap.UndertowHttpServer in project spring-framework by spring-projects.

the class ZeroCopyIntegrationTests method zeroCopy.

@Test
public void zeroCopy() throws Exception {
    // Zero-copy only does not support servlet
    assumeTrue(server instanceof ReactorHttpServer || server instanceof UndertowHttpServer);
    RestTemplate restTemplate = new RestTemplate();
    RequestEntity<?> request = RequestEntity.get(new URI("http://localhost:" + port)).build();
    ResponseEntity<byte[]> response = restTemplate.exchange(request, byte[].class);
    Resource logo = new ClassPathResource("spring.png", ZeroCopyIntegrationTests.class);
    assertTrue(response.hasBody());
    assertEquals(logo.contentLength(), response.getHeaders().getContentLength());
    assertEquals(logo.contentLength(), response.getBody().length);
    assertEquals(MediaType.IMAGE_PNG, response.getHeaders().getContentType());
}
Also used : ReactorHttpServer(org.springframework.http.server.reactive.bootstrap.ReactorHttpServer) RestTemplate(org.springframework.web.client.RestTemplate) ClassPathResource(org.springframework.core.io.ClassPathResource) Resource(org.springframework.core.io.Resource) UndertowHttpServer(org.springframework.http.server.reactive.bootstrap.UndertowHttpServer) URI(java.net.URI) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test)

Example 2 with UndertowHttpServer

use of org.springframework.http.server.reactive.bootstrap.UndertowHttpServer in project spring-framework by spring-projects.

the class AbstractWebSocketIntegrationTests method arguments.

@Parameters(name = "client[{0}] - server [{1}]")
public static Object[][] arguments() throws IOException {
    Flux<? extends WebSocketClient> clients = Flux.concat(Flux.just(new StandardWebSocketClient()).repeat(5), Flux.just(new JettyWebSocketClient()).repeat(5), Flux.just(new ReactorNettyWebSocketClient()).repeat(5), Flux.just(new RxNettyWebSocketClient()).repeat(5), Flux.just(new UndertowWebSocketClient(Xnio.getInstance().createWorker(OptionMap.EMPTY))).repeat(5));
    Flux<? extends HttpServer> servers = Flux.just(new TomcatHttpServer(TMP_DIR.getAbsolutePath(), WsContextListener.class), new JettyHttpServer(), new ReactorHttpServer(), new RxNettyHttpServer(), new UndertowHttpServer()).repeat(5);
    Flux<? extends Class<?>> configs = Flux.just(TomcatConfig.class, JettyConfig.class, ReactorNettyConfig.class, RxNettyConfig.class, UndertowConfig.class).repeat(5);
    return Flux.zip(clients, servers, configs).map(Tuple3::toArray).collectList().block().toArray(new Object[25][2]);
}
Also used : RxNettyWebSocketClient(org.springframework.web.reactive.socket.client.RxNettyWebSocketClient) ReactorHttpServer(org.springframework.http.server.reactive.bootstrap.ReactorHttpServer) ReactorNettyWebSocketClient(org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient) StandardWebSocketClient(org.springframework.web.reactive.socket.client.StandardWebSocketClient) RxNettyHttpServer(org.springframework.http.server.reactive.bootstrap.RxNettyHttpServer) UndertowHttpServer(org.springframework.http.server.reactive.bootstrap.UndertowHttpServer) JettyWebSocketClient(org.springframework.web.reactive.socket.client.JettyWebSocketClient) TomcatHttpServer(org.springframework.http.server.reactive.bootstrap.TomcatHttpServer) UndertowWebSocketClient(org.springframework.web.reactive.socket.client.UndertowWebSocketClient) JettyHttpServer(org.springframework.http.server.reactive.bootstrap.JettyHttpServer) Parameters(org.junit.runners.Parameterized.Parameters)

Aggregations

ReactorHttpServer (org.springframework.http.server.reactive.bootstrap.ReactorHttpServer)2 UndertowHttpServer (org.springframework.http.server.reactive.bootstrap.UndertowHttpServer)2 URI (java.net.URI)1 Test (org.junit.Test)1 Parameters (org.junit.runners.Parameterized.Parameters)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 Resource (org.springframework.core.io.Resource)1 JettyHttpServer (org.springframework.http.server.reactive.bootstrap.JettyHttpServer)1 RxNettyHttpServer (org.springframework.http.server.reactive.bootstrap.RxNettyHttpServer)1 TomcatHttpServer (org.springframework.http.server.reactive.bootstrap.TomcatHttpServer)1 RestTemplate (org.springframework.web.client.RestTemplate)1 JettyWebSocketClient (org.springframework.web.reactive.socket.client.JettyWebSocketClient)1 ReactorNettyWebSocketClient (org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient)1 RxNettyWebSocketClient (org.springframework.web.reactive.socket.client.RxNettyWebSocketClient)1 StandardWebSocketClient (org.springframework.web.reactive.socket.client.StandardWebSocketClient)1 UndertowWebSocketClient (org.springframework.web.reactive.socket.client.UndertowWebSocketClient)1