From 0ee7a3cfea4c47626c333f0bfa315ee6913a20f4 Mon Sep 17 00:00:00 2001 From: Santiago Pericasgeertsen Date: Mon, 22 May 2023 11:10:55 -0400 Subject: [PATCH] Removed examples/webserver/jersey. --- examples/webserver/jersey/README.md | 18 ----- examples/webserver/jersey/pom.xml | 81 ------------------- .../webserver/examples/jersey/HelloWorld.java | 39 --------- .../webserver/examples/jersey/Main.java | 79 ------------------ .../examples/jersey/package-info.java | 23 ------ .../src/main/resources/logging.properties | 26 ------ .../examples/jersey/HelloWorldTest.java | 73 ----------------- examples/webserver/pom.xml | 1 - 8 files changed, 340 deletions(-) delete mode 100644 examples/webserver/jersey/README.md delete mode 100644 examples/webserver/jersey/pom.xml delete mode 100644 examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/HelloWorld.java delete mode 100644 examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/Main.java delete mode 100644 examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/package-info.java delete mode 100644 examples/webserver/jersey/src/main/resources/logging.properties delete mode 100644 examples/webserver/jersey/src/test/java/io/helidon/reactive/webserver/examples/jersey/HelloWorldTest.java diff --git a/examples/webserver/jersey/README.md b/examples/webserver/jersey/README.md deleted file mode 100644 index 620d41954c2..00000000000 --- a/examples/webserver/jersey/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# WebServer Jersey Application Example - -An example of **Jersey** integration into the **Web Server**. - -This is just a simple Hello World example. A user can start the application using the `WebServerJerseyMain` class -and `GET` the `Hello World!` response by accessing `http://localhost:8080/jersey/hello`. - -## Build and run - -```bash -mvn package -java -jar target/helidon-examples-webserver-jersey.jar -``` - -Make an HTTP request to application: -```bash -curl http://localhost:8080/jersey/hello -``` diff --git a/examples/webserver/jersey/pom.xml b/examples/webserver/jersey/pom.xml deleted file mode 100644 index be992bb64bb..00000000000 --- a/examples/webserver/jersey/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - 4.0.0 - - io.helidon.applications - helidon-se - 4.0.0-SNAPSHOT - ../../../applications/se/pom.xml - - io.helidon.examples.webserver - helidon-examples-webserver-jersey - Helidon WebServer Examples Jersey - - - WebServer Jersey example application - - - - io.helidon.reactive.webserver.examples.jersey.Main - - - - - io.helidon.reactive.webserver - helidon-reactive-webserver - - - io.helidon.reactive.webserver - helidon-reactive-webserver-jersey - - - org.junit.jupiter - junit-jupiter-api - test - - - org.hamcrest - hamcrest-all - test - - - io.helidon.reactive.webserver - helidon-reactive-webserver-test-support - test - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - - diff --git a/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/HelloWorld.java b/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/HelloWorld.java deleted file mode 100644 index 6c445285332..00000000000 --- a/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/HelloWorld.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.reactive.webserver.examples.jersey; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.Response; - -/** - * The Hello World Example JAX-RS resource. - */ -@Path("/") -public class HelloWorld { - - /** - * A simple resource returning {@code Hello World!} string. - * - * @return {@code Hello World!} string as a response - */ - @GET - @Path("hello") - public Response hello() { - return Response.ok("Hello World!").build(); - } -} diff --git a/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/Main.java b/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/Main.java deleted file mode 100644 index 97f4f7273f2..00000000000 --- a/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/Main.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.reactive.webserver.examples.jersey; - -import java.util.concurrent.CompletionStage; - -import io.helidon.logging.common.LogConfig; -import io.helidon.reactive.webserver.Routing; -import io.helidon.reactive.webserver.WebServer; -import io.helidon.reactive.webserver.jersey.JerseySupport; - -import org.glassfish.jersey.server.ResourceConfig; - -/** - * The WebServer Jersey Main example class. - * - * @see #main(String[]) - * @see #startServer(int) - */ -public final class Main { - - private Main() { - } - - /** - * Run the Jersey WebServer Example. - * - * @param args arguments are not used - */ - public static void main(String[] args) { - // configure logging in order to not have the standard JVM defaults - LogConfig.configureRuntime(); - - // start the server on port 8080 - startServer(8080); - } - - /** - * Start the WebServer based on the provided configuration. When running from - * a test, pass {@link null} to have a dynamically allocated port - * the server listens on. - * - * @param port port to start server on - * @return a completion stage indicating that the server has started and is ready to - * accept http requests - */ - static CompletionStage startServer(int port) { - WebServer webServer = WebServer.builder( - Routing.builder() - // register a Jersey Application at the '/jersey' context path - .register("/jersey", - JerseySupport.create(new ResourceConfig(HelloWorld.class))) - .build()) - .port(port) - .build(); - - return webServer.start() - .whenComplete((server, t) -> { - System.out.println("Jersey WebServer started."); - System.out.println("To stop the application, hit CTRL+C"); - System.out.println("Try the hello world resource at: http://localhost:" + server - .port() + "/jersey/hello"); - }); - } -} diff --git a/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/package-info.java b/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/package-info.java deleted file mode 100644 index 739e8868e04..00000000000 --- a/examples/webserver/jersey/src/main/java/io/helidon/reactive/webserver/examples/jersey/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * An example of Jersey integration into the Web Server. - * - * @see io.helidon.reactive.webserver.jersey.JerseySupport - * @see io.helidon.reactive.webserver.WebServer - */ -package io.helidon.reactive.webserver.examples.jersey; diff --git a/examples/webserver/jersey/src/main/resources/logging.properties b/examples/webserver/jersey/src/main/resources/logging.properties deleted file mode 100644 index 8c6d7322d28..00000000000 --- a/examples/webserver/jersey/src/main/resources/logging.properties +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2017, 2022 Oracle and/or its affiliates. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -#All attributes details -handlers=io.helidon.logging.jul.HelidonConsoleHandler -java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n - -#All log level details -.level=WARNING - -io.helidon.reactive.webserver.level=INFO -org.glassfish.jersey.internal.Errors.level=SEVERE diff --git a/examples/webserver/jersey/src/test/java/io/helidon/reactive/webserver/examples/jersey/HelloWorldTest.java b/examples/webserver/jersey/src/test/java/io/helidon/reactive/webserver/examples/jersey/HelloWorldTest.java deleted file mode 100644 index 9cbdde4245b..00000000000 --- a/examples/webserver/jersey/src/test/java/io/helidon/reactive/webserver/examples/jersey/HelloWorldTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.reactive.webserver.examples.jersey; - -import java.util.concurrent.TimeUnit; - -import io.helidon.reactive.webserver.WebServer; - -import jakarta.ws.rs.client.Client; -import jakarta.ws.rs.client.ClientBuilder; -import jakarta.ws.rs.core.Response; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * The Jersey Client based example that tests the {@link HelloWorld} resource - * that gets served by running {@link Main#startServer(int)} - * - * @see HelloWorld - * @see Main - */ -public class HelloWorldTest { - - private static WebServer webServer; - - @BeforeAll - public static void startTheServer() throws Exception { - webServer = Main.startServer(0) - .toCompletableFuture() - .get(10, TimeUnit.SECONDS); - } - - @AfterAll - public static void stopServer() throws Exception { - if (webServer != null) { - webServer.shutdown() - .toCompletableFuture() - .get(10, TimeUnit.SECONDS); - } - } - - @Test - public void testHelloWorld() throws Exception { - Client client = ClientBuilder.newClient(); - try (Response response = client.target("http://localhost:" + webServer.port()) - .path("jersey/hello") - .request() - .get()) { - assertThat("Unexpected response; status: " + response.getStatus(), - response.readEntity(String.class), is("Hello World!")); - } finally { - client.close(); - } - } -} diff --git a/examples/webserver/pom.xml b/examples/webserver/pom.xml index b12d98d8ff0..2b2d96d44b7 100644 --- a/examples/webserver/pom.xml +++ b/examples/webserver/pom.xml @@ -36,7 +36,6 @@ tutorial comment-aas static-content - jersey opentracing streaming websocket