From 54a2854a52fa4e0d59781676d70bcc64c8cc8d9a Mon Sep 17 00:00:00 2001 From: jansupol Date: Mon, 6 Jun 2022 14:55:50 +0200 Subject: [PATCH] Possibly use jersey WebServer with SeBootstrap.Configurator Document SeBootstrap API Signed-off-by: jansupol --- .../httpserver/GrizzlyHttpServerProvider.java | 17 +- .../GrizzlyHttpServerProviderTest.java | 12 +- .../jersey/jdkhttp/JdkHttpServerProvider.java | 15 +- .../jdkhttp/JdkHttpServerProviderTest.java | 12 +- .../jersey/jetty/JettyHttpServerProvider.java | 17 +- .../jetty/JettyHttpServerProviderTest.java | 11 +- .../httpserver/NettyHttpServerProvider.java | 15 +- .../NettyHttpServerProviderTest.java | 11 +- .../simple/SimpleHttpServerProvider.java | 15 +- .../simple/SimpleHttpServerProviderTest.java | 11 +- .../JerseySeBootstrapConfiguration.java | 2 +- .../jersey/server/ServerProperties.java | 4 +- .../jersey/server/WebServerFactory.java | 7 +- .../server/internal/RuntimeDelegateImpl.java | 10 +- .../jersey/server/spi/WebServerProvider.java | 29 +++- .../server/spi/WebServerProviderTest.java | 159 ++++++++++++++++++ docs/src/main/docbook/appendix-properties.xml | 72 ++++++++ docs/src/main/docbook/deployment.xml | 82 +++++++++ docs/src/main/docbook/jersey.ent | 11 ++ .../jmockit/server/WebServerFactoryTest.java | 10 +- 20 files changed, 426 insertions(+), 96 deletions(-) create mode 100644 core-server/src/test/java/org/glassfish/jersey/server/spi/WebServerProviderTest.java diff --git a/containers/grizzly2-http/src/main/java/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerProvider.java b/containers/grizzly2-http/src/main/java/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerProvider.java index a3f911c61f..f9cfac2163 100644 --- a/containers/grizzly2-http/src/main/java/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerProvider.java +++ b/containers/grizzly2-http/src/main/java/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -17,6 +17,7 @@ package org.glassfish.jersey.grizzly2.httpserver; +import jakarta.ws.rs.SeBootstrap; import jakarta.ws.rs.core.Application; import org.glassfish.grizzly.http.server.HttpServer; @@ -33,18 +34,18 @@ public final class GrizzlyHttpServerProvider implements WebServerProvider { @Override - public final T createServer(final Class type, final Application application, - final JerseySeBootstrapConfiguration configuration) { - return GrizzlyHttpServer.class == type || WebServer.class == type - ? type.cast(new GrizzlyHttpServer(application, configuration)) + public T createServer(final Class type, final Application application, + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(GrizzlyHttpServer.class, type, configuration) + ? type.cast(new GrizzlyHttpServer(application, JerseySeBootstrapConfiguration.from(configuration))) : null; } @Override public T createServer(Class type, Class applicationClass, - JerseySeBootstrapConfiguration configuration) { - return GrizzlyHttpServer.class == type || WebServer.class == type - ? type.cast(new GrizzlyHttpServer(applicationClass, configuration)) + SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(GrizzlyHttpServer.class, type, configuration) + ? type.cast(new GrizzlyHttpServer(applicationClass, JerseySeBootstrapConfiguration.from(configuration))) : null; } } diff --git a/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerProviderTest.java b/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerProviderTest.java index a7310d048d..6f933cddcd 100644 --- a/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerProviderTest.java +++ b/containers/grizzly2-http/src/test/java/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -17,7 +17,6 @@ package org.glassfish.jersey.grizzly2.httpserver; -import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; @@ -45,7 +44,6 @@ import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.jersey.internal.util.PropertiesHelper; -import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.spi.Container; import org.glassfish.jersey.server.spi.WebServer; @@ -82,10 +80,9 @@ private void shouldProvideServer(final Object application, final Resource resour final SeBootstrap.Configuration configuration = configuration(getPort()); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); final WebServer webServer = Application.class.isInstance(application) - ? webServerProvider.createServer(WebServer.class, (Application) application, jerseySeConfig) - : webServerProvider.createServer(WebServer.class, (Class) application, jerseySeConfig); + ? webServerProvider.createServer(WebServer.class, (Application) application, configuration) + : webServerProvider.createServer(WebServer.class, (Class) application, configuration); final Object nativeHandle = webServer.unwrap(Object.class); final CompletionStage start = webServer.start(); final Object startResult = start.toCompletableFuture().get(); @@ -157,8 +154,7 @@ public void shouldScanFreePort() { final SeBootstrap.Configuration configuration = configuration(SeBootstrap.Configuration.FREE_PORT); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); - final WebServer webServer = webServerProvider.createServer(WebServer.class, application, jerseySeConfig); + final WebServer webServer = webServerProvider.createServer(WebServer.class, application, configuration); // then assertThat(webServer.port(), is(greaterThan(0))); diff --git a/containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerProvider.java b/containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerProvider.java index 4510c53fc8..b9edb3022c 100644 --- a/containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerProvider.java +++ b/containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -17,6 +17,7 @@ package org.glassfish.jersey.jdkhttp; +import jakarta.ws.rs.SeBootstrap; import jakarta.ws.rs.core.Application; import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; @@ -35,17 +36,17 @@ public final class JdkHttpServerProvider implements WebServerProvider { @Override public T createServer(final Class type, final Application application, - final JerseySeBootstrapConfiguration configuration) { - return JdkHttpServer.class == type || WebServer.class == type - ? type.cast(new JdkHttpServer(application, configuration)) + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(JdkHttpServer.class, type, configuration) + ? type.cast(new JdkHttpServer(application, JerseySeBootstrapConfiguration.from(configuration))) : null; } @Override public T createServer(final Class type, final Class applicationClass, - final JerseySeBootstrapConfiguration configuration) { - return JdkHttpServer.class == type || WebServer.class == type - ? type.cast(new JdkHttpServer(applicationClass, configuration)) + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(JdkHttpServer.class, type, configuration) + ? type.cast(new JdkHttpServer(applicationClass, JerseySeBootstrapConfiguration.from(configuration))) : null; } } diff --git a/containers/jdk-http/src/test/java/org/glassfish/jersey/jdkhttp/JdkHttpServerProviderTest.java b/containers/jdk-http/src/test/java/org/glassfish/jersey/jdkhttp/JdkHttpServerProviderTest.java index ade52847c5..c37f7670b1 100644 --- a/containers/jdk-http/src/test/java/org/glassfish/jersey/jdkhttp/JdkHttpServerProviderTest.java +++ b/containers/jdk-http/src/test/java/org/glassfish/jersey/jdkhttp/JdkHttpServerProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -18,7 +18,6 @@ package org.glassfish.jersey.jdkhttp; import static java.lang.Boolean.FALSE; -import static java.lang.Boolean.TRUE; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.Matchers.greaterThan; @@ -44,7 +43,6 @@ import jakarta.ws.rs.core.UriBuilder; import org.glassfish.jersey.internal.util.PropertiesHelper; -import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.spi.Container; import org.glassfish.jersey.server.spi.WebServer; @@ -83,10 +81,9 @@ private void shouldProvideServer(final Object application, final Resource resour final SeBootstrap.Configuration configuration = configuration(getPort()); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); final WebServer webServer = Application.class.isInstance(application) - ? webServerProvider.createServer(WebServer.class, (Application) application, jerseySeConfig) - : webServerProvider.createServer(WebServer.class, (Class) application, jerseySeConfig); + ? webServerProvider.createServer(WebServer.class, (Application) application, configuration) + : webServerProvider.createServer(WebServer.class, (Class) application, configuration); final Object nativeHandle = webServer.unwrap(Object.class); final CompletionStage start = webServer.start(); final Object startResult = start.toCompletableFuture().get(); @@ -158,8 +155,7 @@ public final void shouldScanFreePort() throws InterruptedException, ExecutionExc final SeBootstrap.Configuration configuration = configuration(SeBootstrap.Configuration.FREE_PORT); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); - final WebServer webServer = webServerProvider.createServer(WebServer.class, application, jerseySeConfig); + final WebServer webServer = webServerProvider.createServer(WebServer.class, application, configuration); // then assertThat(webServer.port(), is(greaterThan(0))); diff --git a/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpServerProvider.java b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpServerProvider.java index fe776b9f40..5122435d85 100644 --- a/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpServerProvider.java +++ b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -17,6 +17,7 @@ package org.glassfish.jersey.jetty; +import jakarta.ws.rs.SeBootstrap; import jakarta.ws.rs.core.Application; import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; @@ -33,18 +34,18 @@ public final class JettyHttpServerProvider implements WebServerProvider { @Override - public final T createServer(final Class type, final Application application, - final JerseySeBootstrapConfiguration configuration) { - return JettyHttpServer.class == type || WebServer.class == type - ? type.cast(new JettyHttpServer(application, configuration)) + public T createServer(final Class type, final Application application, + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(JettyHttpServer.class, type, configuration) + ? type.cast(new JettyHttpServer(application, JerseySeBootstrapConfiguration.from(configuration))) : null; } @Override public T createServer(final Class type, final Class applicationClass, - final JerseySeBootstrapConfiguration configuration) { - return JettyHttpServer.class == type || WebServer.class == type - ? type.cast(new JettyHttpServer(applicationClass, configuration)) + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(JettyHttpServer.class, type, configuration) + ? type.cast(new JettyHttpServer(applicationClass, JerseySeBootstrapConfiguration.from(configuration))) : null; } } diff --git a/containers/jetty-http/src/test/java/org/glassfish/jersey/jetty/JettyHttpServerProviderTest.java b/containers/jetty-http/src/test/java/org/glassfish/jersey/jetty/JettyHttpServerProviderTest.java index 1aa8b45495..81c1bd6c84 100644 --- a/containers/jetty-http/src/test/java/org/glassfish/jersey/jetty/JettyHttpServerProviderTest.java +++ b/containers/jetty-http/src/test/java/org/glassfish/jersey/jetty/JettyHttpServerProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -45,7 +45,6 @@ import jakarta.ws.rs.core.UriBuilder; import org.glassfish.jersey.internal.util.PropertiesHelper; -import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.spi.Container; import org.glassfish.jersey.server.spi.WebServer; @@ -82,10 +81,9 @@ private void shouldProvideServer(final Object application, final Resource resour final SeBootstrap.Configuration configuration = configuration(getPort(), FALSE); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); final WebServer webServer = Application.class.isInstance(application) - ? webServerProvider.createServer(WebServer.class, (Application) application, jerseySeConfig) - : webServerProvider.createServer(WebServer.class, (Class) application, jerseySeConfig); + ? webServerProvider.createServer(WebServer.class, (Application) application, configuration) + : webServerProvider.createServer(WebServer.class, (Class) application, configuration); final Object nativeHandle = webServer.unwrap(Object.class); final CompletionStage start = webServer.start(); final Object startResult = start.toCompletableFuture().get(); @@ -157,8 +155,7 @@ public final void shouldScanFreePort() throws InterruptedException, ExecutionExc final SeBootstrap.Configuration configuration = configuration(SeBootstrap.Configuration.FREE_PORT, TRUE); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); - final WebServer webServer = webServerProvider.createServer(WebServer.class, application, jerseySeConfig); + final WebServer webServer = webServerProvider.createServer(WebServer.class, application, configuration); // then assertThat(webServer.port(), is(greaterThan(0))); diff --git a/containers/netty-http/src/main/java/org/glassfish/jersey/netty/httpserver/NettyHttpServerProvider.java b/containers/netty-http/src/main/java/org/glassfish/jersey/netty/httpserver/NettyHttpServerProvider.java index 34c700e104..0749369a1f 100644 --- a/containers/netty-http/src/main/java/org/glassfish/jersey/netty/httpserver/NettyHttpServerProvider.java +++ b/containers/netty-http/src/main/java/org/glassfish/jersey/netty/httpserver/NettyHttpServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -17,6 +17,7 @@ package org.glassfish.jersey.netty.httpserver; +import jakarta.ws.rs.SeBootstrap; import jakarta.ws.rs.core.Application; import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; @@ -35,17 +36,17 @@ public final class NettyHttpServerProvider implements WebServerProvider { @Override public T createServer(final Class type, final Application application, - final JerseySeBootstrapConfiguration configuration) { - return NettyHttpServer.class == type || WebServer.class == type - ? type.cast(new NettyHttpServer(application, configuration)) + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(NettyHttpServer.class, type, configuration) + ? type.cast(new NettyHttpServer(application, JerseySeBootstrapConfiguration.from(configuration))) : null; } @Override public T createServer(final Class type, final Class applicationClass, - final JerseySeBootstrapConfiguration configuration) { - return NettyHttpServer.class == type || WebServer.class == type - ? type.cast(new NettyHttpServer(applicationClass, configuration)) + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(NettyHttpServer.class, type, configuration) + ? type.cast(new NettyHttpServer(applicationClass, JerseySeBootstrapConfiguration.from(configuration))) : null; } } diff --git a/containers/netty-http/src/test/java/org/glassfish/jersey/netty/httpserver/NettyHttpServerProviderTest.java b/containers/netty-http/src/test/java/org/glassfish/jersey/netty/httpserver/NettyHttpServerProviderTest.java index 3837377475..69b2e7e4cd 100644 --- a/containers/netty-http/src/test/java/org/glassfish/jersey/netty/httpserver/NettyHttpServerProviderTest.java +++ b/containers/netty-http/src/test/java/org/glassfish/jersey/netty/httpserver/NettyHttpServerProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -44,7 +44,6 @@ import jakarta.ws.rs.core.UriBuilder; import org.glassfish.jersey.internal.util.PropertiesHelper; -import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.spi.Container; import org.glassfish.jersey.server.spi.WebServer; @@ -84,10 +83,9 @@ private void shouldProvideServer(final Object application, final Resource resour final SeBootstrap.Configuration configuration = configuration(getPort(), FALSE); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); final WebServer webServer = Application.class.isInstance(application) - ? webServerProvider.createServer(WebServer.class, (Application) application, jerseySeConfig) - : webServerProvider.createServer(WebServer.class, (Class) application, jerseySeConfig); + ? webServerProvider.createServer(WebServer.class, (Application) application, configuration) + : webServerProvider.createServer(WebServer.class, (Class) application, configuration); final Object nativeHandle = webServer.unwrap(Object.class); final CompletionStage start = webServer.start(); final Object startResult = start.toCompletableFuture().get(); @@ -160,8 +158,7 @@ public final void shouldScanFreePort() throws InterruptedException, ExecutionExc final SeBootstrap.Configuration configuration = configuration(SeBootstrap.Configuration.FREE_PORT, TRUE); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); - final WebServer webServer = webServerProvider.createServer(WebServer.class, application, jerseySeConfig); + final WebServer webServer = webServerProvider.createServer(WebServer.class, application, configuration); // then assertThat(webServer.port(), is(greaterThan(0))); diff --git a/containers/simple-http/src/main/java/org/glassfish/jersey/simple/SimpleHttpServerProvider.java b/containers/simple-http/src/main/java/org/glassfish/jersey/simple/SimpleHttpServerProvider.java index c4a26a7d98..33bd6a7dc5 100644 --- a/containers/simple-http/src/main/java/org/glassfish/jersey/simple/SimpleHttpServerProvider.java +++ b/containers/simple-http/src/main/java/org/glassfish/jersey/simple/SimpleHttpServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -17,6 +17,7 @@ package org.glassfish.jersey.simple; +import jakarta.ws.rs.SeBootstrap; import jakarta.ws.rs.core.Application; import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; @@ -33,17 +34,17 @@ public final class SimpleHttpServerProvider implements WebServerProvider { @Override public T createServer(final Class type, final Application application, - final JerseySeBootstrapConfiguration configuration) { - return SimpleHttpServer.class == type || WebServer.class == type - ? type.cast(new SimpleHttpServer(application, configuration)) + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(SimpleHttpServer.class, type, configuration) + ? type.cast(new SimpleHttpServer(application, JerseySeBootstrapConfiguration.from(configuration))) : null; } @Override public T createServer(final Class type, final Class applicationClass, - final JerseySeBootstrapConfiguration configuration) { - return SimpleHttpServer.class == type || WebServer.class == type - ? type.cast(new SimpleHttpServer(applicationClass, configuration)) + final SeBootstrap.Configuration configuration) { + return WebServerProvider.isSupportedWebServer(SimpleHttpServer.class, type, configuration) + ? type.cast(new SimpleHttpServer(applicationClass, JerseySeBootstrapConfiguration.from(configuration))) : null; } } diff --git a/containers/simple-http/src/test/java/org/glassfish/jersey/simple/SimpleHttpServerProviderTest.java b/containers/simple-http/src/test/java/org/glassfish/jersey/simple/SimpleHttpServerProviderTest.java index 02314ea784..c32e77caac 100644 --- a/containers/simple-http/src/test/java/org/glassfish/jersey/simple/SimpleHttpServerProviderTest.java +++ b/containers/simple-http/src/test/java/org/glassfish/jersey/simple/SimpleHttpServerProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -44,7 +44,6 @@ import jakarta.ws.rs.core.UriBuilder; import org.glassfish.jersey.internal.util.PropertiesHelper; -import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.spi.Container; import org.glassfish.jersey.server.spi.WebServer; @@ -82,10 +81,9 @@ private void shouldProvideServer(final Object application, final Resource resour final SeBootstrap.Configuration configuration = configuration(getPort(), FALSE); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); final WebServer webServer = Application.class.isInstance(application) - ? webServerProvider.createServer(WebServer.class, (Application) application, jerseySeConfig) - : webServerProvider.createServer(WebServer.class, (Class) application, jerseySeConfig); + ? webServerProvider.createServer(WebServer.class, (Application) application, configuration) + : webServerProvider.createServer(WebServer.class, (Class) application, configuration); final Object nativeHandle = webServer.unwrap(Object.class); final CompletionStage start = webServer.start(); final Object startResult = start.toCompletableFuture().get(); @@ -157,8 +155,7 @@ public final void shouldScanFreePort() throws InterruptedException, ExecutionExc final SeBootstrap.Configuration configuration = configuration(SeBootstrap.Configuration.FREE_PORT, TRUE); // when - final JerseySeBootstrapConfiguration jerseySeConfig = JerseySeBootstrapConfiguration.from(configuration); - final WebServer webServer = webServerProvider.createServer(WebServer.class, application, jerseySeConfig); + final WebServer webServer = webServerProvider.createServer(WebServer.class, application, configuration); // then assertThat(webServer.port(), is(greaterThan(0))); diff --git a/core-server/src/main/java/org/glassfish/jersey/server/JerseySeBootstrapConfiguration.java b/core-server/src/main/java/org/glassfish/jersey/server/JerseySeBootstrapConfiguration.java index 3bfe5db775..0f1d6d7e67 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/JerseySeBootstrapConfiguration.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/JerseySeBootstrapConfiguration.java @@ -96,7 +96,7 @@ private int resolvePort() { } private int _resolvePort(boolean allowPrivilegedPort) { - final int basePort = allowPrivilegedPort ? 0 : 1023; + final int basePort = allowPrivilegedPort ? 0 : 1024; // Get the initial range parameters final int lower = basePort; final int range = 0xFFFF; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/ServerProperties.java b/core-server/src/main/java/org/glassfish/jersey/server/ServerProperties.java index 099ce70229..5d8a3ad16d 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/ServerProperties.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/ServerProperties.java @@ -775,8 +775,8 @@ public final class ServerProperties { * {@code WEBSERVER_ALLOW_PRIVILEGED_PORTS} is {@code false}. *

*

- * If {@link jakarta.ws.rs.SeBootstrap.Configuration#PORT} is set to {@code 0}, the implementation chooses random ports - * (0-65535) when {@code WEBSERVER_ALLOW_PRIVILEGED_PORTS} is {@code true}, or (1024-65535) when + * If {@link jakarta.ws.rs.SeBootstrap.Configuration#PORT} is set to {@code 0}, the implementation scans for random unused + * port (0-65535) when {@code WEBSERVER_ALLOW_PRIVILEGED_PORTS} is {@code true}, or (1024-65535) when * {@code WEBSERVER_ALLOW_PRIVILEGED_PORTS} is {@code false.} *

*

diff --git a/core-server/src/main/java/org/glassfish/jersey/server/WebServerFactory.java b/core-server/src/main/java/org/glassfish/jersey/server/WebServerFactory.java index 6454fc1732..2b61d4ae54 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/WebServerFactory.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/WebServerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -18,6 +18,7 @@ package org.glassfish.jersey.server; import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.SeBootstrap; import jakarta.ws.rs.core.Application; import org.glassfish.jersey.internal.ServiceFinder; @@ -63,7 +64,7 @@ private WebServerFactory() { * if no server provider supports the type. */ public static T createServer(final Class type, final Application application, - final JerseySeBootstrapConfiguration configuration) { + final SeBootstrap.Configuration configuration) { for (final WebServerProvider webServerProvider : ServiceFinder.find(WebServerProvider.class)) { final T server = webServerProvider.createServer(type, application, configuration); if (server != null) { @@ -99,7 +100,7 @@ public static T createServer(final Class type, final Ap * if no server provider supports the type. */ public static T createServer(final Class type, final Class application, - final JerseySeBootstrapConfiguration configuration) { + final SeBootstrap.Configuration configuration) { for (final WebServerProvider webServerProvider : ServiceFinder.find(WebServerProvider.class)) { final T server = webServerProvider.createServer(type, application, configuration); if (server != null) { diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/RuntimeDelegateImpl.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/RuntimeDelegateImpl.java index 1af9a406bb..bfaad0e108 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/RuntimeDelegateImpl.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/RuntimeDelegateImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -72,10 +72,8 @@ public CompletableFuture bootstrap(final Application appli ? (Class) configuration.property(ServerProperties.WEBSERVER_CLASS) : WebServer.class; - final JerseySeBootstrapConfiguration jerseySeConfiguration - = JerseySeBootstrapConfiguration.from(configuration); final WebServer webServer - = WebServerFactory.createServer(httpServerClass, application, jerseySeConfiguration); + = WebServerFactory.createServer(httpServerClass, application, configuration); return instance(configuration, webServer); }); } @@ -89,10 +87,8 @@ public CompletableFuture bootstrap(final Class) configuration.property(ServerProperties.WEBSERVER_CLASS) : WebServer.class; - final JerseySeBootstrapConfiguration jerseySeConfiguration - = JerseySeBootstrapConfiguration.from(configuration); final WebServer webServer - = WebServerFactory.createServer(httpServerClass, applicationClass, jerseySeConfiguration); + = WebServerFactory.createServer(httpServerClass, applicationClass, configuration); return instance(configuration, webServer); }); } diff --git a/core-server/src/main/java/org/glassfish/jersey/server/spi/WebServerProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/spi/WebServerProvider.java index 63453ee106..d1d5d2c40d 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/spi/WebServerProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/spi/WebServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -24,7 +24,7 @@ import jakarta.ws.rs.core.Application; import org.glassfish.jersey.server.ApplicationHandler; -import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; +import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.spi.Contract; /** @@ -86,7 +86,7 @@ public interface WebServerProvider { */ T createServer(Class type, Application application, - JerseySeBootstrapConfiguration configuration) throws ProcessingException; + SeBootstrap.Configuration configuration) throws ProcessingException; /** * Creates a server of a given type which runs the given application using the @@ -108,5 +108,26 @@ T createServer(Class type, */ T createServer(Class type, Class applicationClass, - JerseySeBootstrapConfiguration configuration) throws ProcessingException; + SeBootstrap.Configuration configuration) throws ProcessingException; + + + /** + * Utility function that matches {@code WebServerProvider} supported type with the user type passed either + * as {@link ServerProperties#WEBSERVER_CLASS} property (higher priority) or by the {@code userType} argument + * (lower priority). + * @param supportedType The type supported by the {@code WebServerProvider} implementation + * @param userType The user type passed in by the user, usually {@link WebServer} class. + * @param configuration The configuration to check {@link ServerProperties#WEBSERVER_CLASS} property + * @param The {@link WebServer} subtype + * @return @{code true} if the user provided type matches the supported type. + */ + static boolean isSupportedWebServer( + Class supportedType, Class userType, SeBootstrap.Configuration configuration) { + final Object webServerObj = configuration.property(ServerProperties.WEBSERVER_CLASS); + final Class webServerCls = webServerObj == null || WebServer.class.equals(webServerObj) + ? null : (Class) webServerObj; + // WebServer.class.equals(webServerObj) is the default, and then we want userType + return (webServerCls != null && webServerCls.isAssignableFrom(supportedType)) + || (webServerCls == null && userType.isAssignableFrom(supportedType)); + } } diff --git a/core-server/src/test/java/org/glassfish/jersey/server/spi/WebServerProviderTest.java b/core-server/src/test/java/org/glassfish/jersey/server/spi/WebServerProviderTest.java new file mode 100644 index 0000000000..553f76dc0d --- /dev/null +++ b/core-server/src/test/java/org/glassfish/jersey/server/spi/WebServerProviderTest.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.server.spi; + +import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.SeBootstrap; +import jakarta.ws.rs.core.Application; +import org.glassfish.jersey.server.ServerProperties; +import org.junit.Assert; +import org.junit.Test; + +import java.util.concurrent.CompletionStage; + +public class WebServerProviderTest { + @Test + public void testPropertySetsDifferentClass() { + SeBootstrap.Configuration config = + SeBootstrap.Configuration.builder().property(ServerProperties.WEBSERVER_CLASS, WebServerTestImpl2.class).build(); + + Assert.assertNull(new WebServerProviderTestImpl().createServer(WebServerTestImpl.class, Application.class, config)); + } + + @Test + public void testPropertySetsCorrectClass() { + SeBootstrap.Configuration config = + SeBootstrap.Configuration.builder().property(ServerProperties.WEBSERVER_CLASS, WebServerTestImpl.class).build(); + + Assert.assertTrue( + WebServerTestImpl.class.isInstance( + new WebServerProviderTestImpl().createServer(WebServerTestImpl2.class, Application.class, config) + ) + ); + } + + @Test + public void testPropertySetsNothingUserTypeIsWrong() { + SeBootstrap.Configuration config = + SeBootstrap.Configuration.builder().build(); + + Assert.assertNull(new WebServerProviderTestImpl().createServer(WebServerTestImpl2.class, Application.class, config)); + } + + @Test + public void testPropertySetsNothingUserTypeIsCorrectClass() { + SeBootstrap.Configuration config = + SeBootstrap.Configuration.builder().build(); + + Assert.assertTrue( + WebServerTestImpl.class.isInstance( + new WebServerProviderTestImpl().createServer(WebServerTestImpl.class, Application.class, config) + ) + ); + } + + @Test + public void testPropertySetsNothingUserTypeIsSuperClass() { + SeBootstrap.Configuration config = + SeBootstrap.Configuration.builder().build(); + + Assert.assertTrue( + WebServerTestImpl.class.isInstance( + new WebServerProviderTestImpl().createServer(WebServer.class, Application.class, config) + ) + ); + } + + public static class WebServerProviderTestImpl implements WebServerProvider { + + @Override + public T createServer( + Class type, Application application, SeBootstrap.Configuration configuration) throws ProcessingException { + if (WebServerProvider.isSupportedWebServer(WebServerTestImpl.class, type, configuration)) { + return (T) new WebServerTestImpl(); + } + return null; + } + + @Override + public T createServer( + Class type, + Class applicationClass, + SeBootstrap.Configuration configuration) throws ProcessingException { + if (WebServerProvider.isSupportedWebServer(WebServerTestImpl.class, type, configuration)) { + return (T) new WebServerTestImpl(); + } + return null; + } + } + + public static class WebServerTestImpl implements WebServer { + + @Override + public Container container() { + return null; + } + + @Override + public int port() { + return 0; + } + + @Override + public CompletionStage start() { + return null; + } + + @Override + public CompletionStage stop() { + return null; + } + + @Override + public T unwrap(Class nativeClass) { + return null; + } + } + + public static class WebServerTestImpl2 implements WebServer { + + @Override + public Container container() { + return null; + } + + @Override + public int port() { + return 0; + } + + @Override + public CompletionStage start() { + return null; + } + + @Override + public CompletionStage stop() { + return null; + } + + @Override + public T unwrap(Class nativeClass) { + return null; + } + }; +} diff --git a/docs/src/main/docbook/appendix-properties.xml b/docs/src/main/docbook/appendix-properties.xml index dcd681b0d4..46274bdf7c 100644 --- a/docs/src/main/docbook/appendix-properties.xml +++ b/docs/src/main/docbook/appendix-properties.xml @@ -731,6 +731,78 @@ +

+ SeBootstrap and WebServer related configuration properties + + + List of SeBootstrap configuration properties that can be found in &jersey.server.ServerProperties; class. + + + + List of SeBootstrap and WebServer configuration properties + + + + Constant + Value + Description + + + + + &jersey.server.ServerProperties.WEBSERVER_ALLOW_PRIVILEGED_PORTS; + jersey.config.server.bootstrap.webserver.allow.privileged.ports + + + Defines whether to allow privileged ports (0-1023) to be used to start the + &lit.jersey.server.spi.WebServer; implementation to be chosen from the unused ports when the + &lit.jaxrs.SeBootstrap.Configuration; PORT is set to -1 or unset. + + + The default ports are 80 for HTTP and 443 for HTTPS when + WEBSERVER_ALLOW_PRIVILEGED_PORTS is &lit.true; or 8080 for HTTP and 8443 for HTTPS when + WEBSERVER_ALLOW_PRIVILEGED_PORTS is &lit.false;. + + + If &lit.jaxrs.SeBootstrap.Configuration; PORT is set to 0, the implementation scans for + random port (0-65535) when WEBSERVER_ALLOW_PRIVILEGED_PORTS is &lit.true;, or + (1024-65535) when WEBSERVER_ALLOW_PRIVILEGED_PORTS is &lit.false;. + + + The default this is &lit.false;. Use &lit.true; to allow a restricted port number. + + + + + &jersey.server.ServerProperties.WEBSERVER_AUTO_START; + jersey.config.server.bootstrap.webserver.autostart + + + Whether to automatically startup WebServer at bootstrap. + + + By default, servers are immediately listening to connections after bootstrap, + so no explicit invocation of WebServer#start() is needed. + + + + + &jersey.server.ServerProperties.WEBSERVER_CLASS; + jersey.config.server.bootstrap.webserver.class + + + Defines the implementation of WebServer to bootstrap. + + + By default auto-selects the first server provider found. + + + + + +
+
+
Servlet configuration properties diff --git a/docs/src/main/docbook/deployment.xml b/docs/src/main/docbook/deployment.xml index 55d8bb7fdd..9fac43cf6c 100644 --- a/docs/src/main/docbook/deployment.xml +++ b/docs/src/main/docbook/deployment.xml @@ -508,6 +508,88 @@ Channel server = NettyHttpContainerProvider.createServer(baseUri, resourceConfig
+ +
+ Jakarta REST Bootstrap API + + Jakarta REST 3.1 comes with a new API for starting an application in Java SE environment. This + Bootstrap API is mainly represented by &lit.jaxrs.SeBootstrap; interface. + The Jakarta REST application is started as follows: + Application application = new MyApplication(); +SeBootstrap.Configuration.Builder configBuilder = SeBootstrap.Configuration.builder(); +CompletionStage<SeBootstrap.Instance> completionStage = SeBootstrap.start(application, configBuilder.build()); + + + Later, when the SE application is no longer needed, it can be shutdown as follows: + CompletionStage<SeBootstrap.Instance> completionStage = ... +SeBootstrap.Instance instance = completionStage().get(); +instance.stop(); + + + The &lit.jaxrs.SeBootstrap.Configuration; allows for configuring the Jersey runtime. The Jakarta REST 3.1 allows + for configuring the HTTP port, the protocol (HTTP), the hostname, the root path, and SSL. The + &lit.jaxrs.SeBootstrap; is configured as follows: + SeBootstrap.Configuration.Builder configBuilder = SeBootstrap.Configuration.builder(); +configBuilder.property(SeBootstrap.Configuration.PROTOCOL, "HTTP") + .property(SeBootstrap.Configuration.HOST, "localhost") + .property(SeBootstrap.Configuration.PORT, 1234) + .property(SeBootstrap.Configuration.ROOT_PATH, "/root/path"); + + + The &lit.jaxrs.SeBootstrap; deployment is backed up by an HTTP server described in + . If multiple Jersey container modules are on the classpath, + the first found is used. + +
+ +
+ Jersey WebServer SPI + + Jersey &jersey.server.spi.WebServer; and &jersey.server.spi.WebServerProvider; are SPI interfaces similar to + &jersey.server.spi.ContainerProvider; but they are used for the SE deployment. They serve as a bridge between + Jersey containers and &lit.jaxrs.SeBootstrap; API. + The Jakarta REST application can be started as follows: + Application application = new MyApplication(); +SeBootstrap.Configuration.Builder configBuilder = SeBootstrap.Configuration.builder(); +WebServer webServer = WebServerFactory.createServer(WebServer.class, application, configBuilder.build()); + + + Later, when the SE application is no longer needed, it can be shutdown as follows: + WebServer webServer = ... +webServer.stop(); + + + &jersey.server.WebServerFactory; is used to automatically choose among available implementations on a classpath. + If there are multiple implementations available, the first found is used. The user can choose the implementation + of a &lit.jersey.server.spi.WebServer; by a concrete WebServer subclass, for instance: + +WebServer webServer = WebServerFactory.createServer(GrizzlyHttpServer.class, application, configBuilder.build()); + Another way to choose the &lit.jersey.server.spi.WebServer; implementation is by the + &lit.jersey.server.spi.WebServerProvider; implementation: + +WebServer webServer = GrizzlyHttpServerProvider.createServer(WebServer.class, application, configBuilder.build()); + + + For additional customization of the WebServer settings, see . + +
+ + + + When the port is set to -1, the default ports are used. + Unlike the default ports used by the , the &lit.jaxrs.SeBootstrap; API and + &lit.jersey.server.spi.WebServer; SPI use default ports 8080 and 8443, respectively. + + + When the port is set to 0, the implementation scans for a free port. The privileged ports are skipped, and the + scanning starts with port 1024. + + + Using the restricted ports can be ensured either by setting directly the port, or by setting + &jersey.server.ServerProperties.WEBSERVER_ALLOW_PRIVILEGED_PORTS; property to true in the + &lit.jaxrs.SeBootstrap.Configuration; + +
diff --git a/docs/src/main/docbook/jersey.ent b/docs/src/main/docbook/jersey.ent index bc123fe1b1..e7db84fa3a 100644 --- a/docs/src/main/docbook/jersey.ent +++ b/docs/src/main/docbook/jersey.ent @@ -234,6 +234,7 @@ Response.Status"> Response.Status.Family"> Response.StatusType"> +SeBootstrap"> SecurityContext"> StreamingOutput"> UriBuilder"> @@ -605,11 +606,15 @@ ServerProperties.LOCATION_HEADER_RELATIVE_URI_RESOLUTION_RFC7231" > ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE" > ServerProperties.EMPTY_REQUEST_MEDIA_TYPE_MATCHES_ANY_CONSUMES" > +ServerProperties.WEBSERVER_ALLOW_PRIVILEGED_PORTS" > +ServerProperties.WEBSERVER_AUTO_START" > +ServerProperties.WEBSERVER_CLASS" > Uri"> UriConnegFilter"> WadlFeature"> WadlGenerator"> WadlGeneratorConfig"> +WebServerFactory"> MethodHandler"> ComponentModelValidator"> ApplicationEvent"> @@ -652,6 +657,8 @@ ContainerProvider"> ExternalRequestScope"> RequestScopedInitializer"> +WebServer"> +WebServerProvider"> ServletContainer"> ServletProperties"> ServletProperties.FILTER_CONTEXT_PATH"> @@ -791,6 +798,8 @@ @QueryParam"> ReaderInterceptor"> ReaderInterceptorContext"> +SeBootstrap"> +SeBootstrap.Configuration"> WebApplicationException"> WriterInterceptor"> WriterInterceptorContext"> @@ -1112,6 +1121,8 @@ TokenResource"> ComponentProvider"> ContainerProvider"> +WebServer"> +WebServerProvider"> ServletContainer"> ServletProperties"> ServletProperties.FILTER_CONTEXT_PATH"> diff --git a/tests/jmockit/src/test/java/org/glassfish/jersey/tests/jmockit/server/WebServerFactoryTest.java b/tests/jmockit/src/test/java/org/glassfish/jersey/tests/jmockit/server/WebServerFactoryTest.java index 2831134475..974404c0a8 100644 --- a/tests/jmockit/src/test/java/org/glassfish/jersey/tests/jmockit/server/WebServerFactoryTest.java +++ b/tests/jmockit/src/test/java/org/glassfish/jersey/tests/jmockit/server/WebServerFactoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Markus KARG. All rights reserved. * * This program and the accompanying materials are made available under the @@ -23,6 +23,7 @@ import java.util.Iterator; +import jakarta.ws.rs.SeBootstrap; import jakarta.ws.rs.core.Application; import org.glassfish.jersey.internal.ServiceFinder; @@ -30,7 +31,6 @@ import org.glassfish.jersey.internal.guava.Iterators; import org.glassfish.jersey.internal.inject.InjectionManager; import org.glassfish.jersey.internal.inject.InjectionManagerFactory; -import org.glassfish.jersey.server.JerseySeBootstrapConfiguration; import org.glassfish.jersey.server.WebServerFactory; import org.glassfish.jersey.server.spi.WebServer; import org.glassfish.jersey.server.spi.WebServerProvider; @@ -50,7 +50,7 @@ public final class WebServerFactoryTest { @Test public final void shouldBuildServer(@Mocked final Application mockApplication, @Mocked final WebServer mockServer, - @Mocked final JerseySeBootstrapConfiguration mockConfiguration, + @Mocked final SeBootstrap.Configuration mockConfiguration, @Mocked final InjectionManager mockInjectionManager) { // given ServiceFinder.setIteratorProvider(new ServiceIteratorProvider() { @@ -63,7 +63,7 @@ public final Iterator createIterator(final Class service, final String public final U createServer( final Class type, final Application application, - final JerseySeBootstrapConfiguration configuration) { + final SeBootstrap.Configuration configuration) { return application == mockApplication && configuration == mockConfiguration ? type.cast(mockServer) : null; @@ -73,7 +73,7 @@ public final U createServer( public T createServer( final Class type, final Class applicationClass, - final JerseySeBootstrapConfiguration configuration) { + final SeBootstrap.Configuration configuration) { return null; } }