Skip to content

Commit

Permalink
Regression in release-4.0 branch (#1176)
Browse files Browse the repository at this point in the history
* Rollback to previous revision to fix regression introduced by commit ae1f6ef

Signed-off-by: Nicolas NESMON (@NicoNes) <[email protected]>

* Re apply only relevant changes form commit ae1f6ef

Signed-off-by: Nicolas NESMON (@NicoNes) <[email protected]>

* Re apply import ordering changes from commit ae1f6ef

Signed-off-by: Nicolas NESMON (@NicoNes) <[email protected]>

---------

Signed-off-by: Nicolas NESMON (@NicoNes) <[email protected]>
Co-authored-by: Santiago Pericas-Geertsen <[email protected]>
  • Loading branch information
NicoNes and spericas authored Oct 16, 2023
1 parent e5d1b8d commit 7595659
Show file tree
Hide file tree
Showing 44 changed files with 2,042 additions and 337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
import java.net.URI;

import jakarta.ws.rs.SeBootstrap;
import jakarta.ws.rs.SeBootstrap.Configuration;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.UriBuilder;

/**
* Basic Java SE bootstrap example.
Expand All @@ -46,21 +43,12 @@ private BasicJavaSeBootstrapExample() {
* @param args unused command line arguments
* @throws InterruptedException when process is killed
*/
public static final void main(final String[] args) throws InterruptedException {
final Application application = new HelloWorld();

final SeBootstrap.Configuration requestedConfiguration = SeBootstrap.Configuration.builder().build();

SeBootstrap.start(application, requestedConfiguration).thenAccept(instance -> {
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> instance.stop()
.thenAccept(stopResult -> System.out.printf("Stop result: %s [Native stop result: %s].%n",
stopResult, stopResult.unwrap(Object.class)))));

final Configuration actualConfigurarion = instance.configuration();
final URI uri = UriBuilder.newInstance().scheme(actualConfigurarion.protocol().toLowerCase())
.host(actualConfigurarion.host()).port(actualConfigurarion.port())
.path(actualConfigurarion.rootPath()).build();
public static void main(final String[] args) throws InterruptedException {
SeBootstrap.start(HelloWorld.class).thenAccept(instance -> {
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import java.net.URI;

import jakarta.ws.rs.SeBootstrap;
import jakarta.ws.rs.SeBootstrap.Configuration;
import jakarta.ws.rs.SeBootstrap.Configuration.SSLClientAuthentication;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.UriBuilder;

/**
* Java SE Bootstrap Example using TLS Client Authentication.
Expand Down Expand Up @@ -62,22 +59,15 @@ private ClientAuthenticationJavaSeBootstrapExample() {
* @param args unused command line arguments
* @throws InterruptedException when process is killed
*/
public static final void main(final String[] args) throws InterruptedException {
final Application application = new HelloWorld();

public static void main(final String[] args) throws InterruptedException {
final SeBootstrap.Configuration requestedConfiguration = SeBootstrap.Configuration.builder().protocol("HTTPS")
.sslClientAuthentication(SSLClientAuthentication.MANDATORY).build();

SeBootstrap.start(application, requestedConfiguration).thenAccept(instance -> {
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> instance.stop()
.thenAccept(stopResult -> System.out.printf("Stop result: %s [Native stop result: %s].%n",
stopResult, stopResult.unwrap(Object.class)))));

final Configuration actualConfigurarion = instance.configuration();
final URI uri = UriBuilder.newInstance().scheme(actualConfigurarion.protocol().toLowerCase())
.host(actualConfigurarion.host()).port(actualConfigurarion.port())
.path(actualConfigurarion.rootPath()).build();
SeBootstrap.start(HelloWorld.class, requestedConfiguration).thenAccept(instance -> {
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
import java.net.URI;

import jakarta.ws.rs.SeBootstrap;
import jakarta.ws.rs.SeBootstrap.Configuration;
import jakarta.ws.rs.SeBootstrap.Configuration.SSLClientAuthentication;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.UriBuilder;

/**
* Java SE bootstrap example with explicit configuration.
Expand Down Expand Up @@ -56,7 +54,7 @@ private ExplicitJavaSeBootstrapExample() {
* {@code NONE, OPTIONAL, MANDATORY}.
* @throws InterruptedException when process is killed
*/
public static final void main(final String[] args) throws InterruptedException {
public static void main(final String[] args) throws InterruptedException {
final Application application = new HelloWorld();

final String protocol = args[0];
Expand All @@ -69,15 +67,10 @@ public static final void main(final String[] args) throws InterruptedException {
.port(port).rootPath(rootPath).sslClientAuthentication(clientAuth).build();

SeBootstrap.start(application, requestedConfiguration).thenAccept(instance -> {
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> instance.stop()
.thenAccept(stopResult -> System.out.printf("Stop result: %s [Native stop result: %s].%n",
stopResult, stopResult.unwrap(Object.class)))));

final Configuration actualConfigurarion = instance.configuration();
final URI uri = UriBuilder.newInstance().scheme(actualConfigurarion.protocol().toLowerCase())
.host(actualConfigurarion.host()).port(actualConfigurarion.port())
.path(actualConfigurarion.rootPath()).build();
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@

import java.net.URI;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;

import jakarta.ws.rs.SeBootstrap;
import jakarta.ws.rs.SeBootstrap.Configuration;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.UriBuilder;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;

/**
* Java SE bootstrap example utilizing an external configuration system.
Expand Down Expand Up @@ -71,7 +68,7 @@ private ExternalConfigJavaSeBootstrapExample() {
* @param args unused command line arguments
* @throws InterruptedException when process is killed
*/
public static final void main(final String[] args) throws InterruptedException {
public static void main(final String[] args) throws InterruptedException {
final Application application = new HelloWorld();

final Config config = ConfigProvider.getConfig();
Expand All @@ -80,15 +77,10 @@ public static final void main(final String[] args) throws InterruptedException {
.build();

SeBootstrap.start(application, requestedConfiguration).thenAccept(instance -> {
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> instance.stop()
.thenAccept(stopResult -> System.out.printf("Stop result: %s [Native stop result: %s].%n",
stopResult, stopResult.unwrap(Object.class)))));

final Configuration actualConfigurarion = instance.configuration();
final URI uri = UriBuilder.newInstance().scheme(actualConfigurarion.protocol().toLowerCase())
.host(actualConfigurarion.host()).port(actualConfigurarion.port())
.path(actualConfigurarion.rootPath()).build();
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
import java.net.URI;

import jakarta.ws.rs.SeBootstrap;
import jakarta.ws.rs.SeBootstrap.Configuration;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.UriBuilder;

/**
* Java SE bootstrap example using HTTPS.
Expand Down Expand Up @@ -57,21 +55,16 @@ private HttpsJavaSeBootstrapExample() {
* @param args unused command line arguments
* @throws InterruptedException when process is killed
*/
public static final void main(final String[] args) throws InterruptedException {
public static void main(final String[] args) throws InterruptedException {
final Application application = new HelloWorld();

final SeBootstrap.Configuration requestedConfiguration = SeBootstrap.Configuration.builder().protocol("HTTPS").build();

SeBootstrap.start(application, requestedConfiguration).thenAccept(instance -> {
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> instance.stop()
.thenAccept(stopResult -> System.out.printf("Stop result: %s [Native stop result: %s].%n",
stopResult, stopResult.unwrap(Object.class)))));

final Configuration actualConfigurarion = instance.configuration();
final URI uri = UriBuilder.newInstance().scheme(actualConfigurarion.protocol().toLowerCase())
.host(actualConfigurarion.host()).port(actualConfigurarion.port())
.path(actualConfigurarion.rootPath()).build();
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
import java.net.URI;

import jakarta.ws.rs.SeBootstrap;
import jakarta.ws.rs.SeBootstrap.Configuration;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.UriBuilder;

/**
* Java SE bootstrap example demonstrating the use of native properties.
Expand Down Expand Up @@ -56,7 +54,7 @@ private NativeJavaSeBootstrapExample() {
* @throws InterruptedException when process is killed
* @throws ClassNotFoundException when Jersey's Grizzly backend is not on the classpath
*/
public static final void main(final String[] args) throws InterruptedException, ClassNotFoundException {
public static void main(final String[] args) throws InterruptedException, ClassNotFoundException {
final Application application = new HelloWorld();

final SeBootstrap.Configuration requestedConfiguration = SeBootstrap.Configuration.builder()
Expand All @@ -65,15 +63,10 @@ public static final void main(final String[] args) throws InterruptedException,
.build();

SeBootstrap.start(application, requestedConfiguration).thenAccept(instance -> {
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> instance.stop()
.thenAccept(stopResult -> System.out.printf("Stop result: %s [Native stop result: %s].%n",
stopResult, stopResult.unwrap(Object.class)))));

final Configuration actualConfigurarion = instance.configuration();
final URI uri = UriBuilder.newInstance().scheme(actualConfigurarion.protocol().toLowerCase())
.host(actualConfigurarion.host()).port(actualConfigurarion.port())
.path(actualConfigurarion.rootPath()).build();
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@

import java.net.URI;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;

import jakarta.ws.rs.SeBootstrap;
import jakarta.ws.rs.SeBootstrap.Configuration;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.UriBuilder;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;

/**
* Java SE bootstrap example utilizing a property provider.
Expand Down Expand Up @@ -69,7 +66,7 @@ private PropertyProviderJavaSeBootstrapExample() {
* @param args unused command line arguments
* @throws InterruptedException when process is killed
*/
public static final void main(final String[] args) throws InterruptedException {
public static void main(final String[] args) throws InterruptedException {
final Application application = new HelloWorld();

final Config config = ConfigProvider.getConfig();
Expand All @@ -78,15 +75,10 @@ public static final void main(final String[] args) throws InterruptedException {
.protocol("HTTPS").build();

SeBootstrap.start(application, requestedConfiguration).thenAccept(instance -> {
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> instance.stop()
.thenAccept(stopResult -> System.out.printf("Stop result: %s [Native stop result: %s].%n",
stopResult, stopResult.unwrap(Object.class)))));

final Configuration actualConfigurarion = instance.configuration();
final URI uri = UriBuilder.newInstance().scheme(actualConfigurarion.protocol().toLowerCase())
.host(actualConfigurarion.host()).port(actualConfigurarion.port())
.path(actualConfigurarion.rootPath()).build();
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
import java.security.KeyStore;

import jakarta.ws.rs.SeBootstrap;
import jakarta.ws.rs.SeBootstrap.Configuration;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.UriBuilder;

/**
* Java SE bootstrap example using TLS customization.
Expand All @@ -56,7 +54,7 @@ private TlsJavaSeBootstrapExample() {
* @throws IOException in case file access fails
* @throws InterruptedException when process is killed
*/
public static final void main(final String[] args)
public static void main(final String[] args)
throws GeneralSecurityException, IOException, InterruptedException {
final Application application = new HelloWorld();

Expand All @@ -75,15 +73,10 @@ public static final void main(final String[] args)
.sslContext(sslContext).build();

SeBootstrap.start(application, requestedConfiguration).thenAccept(instance -> {
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> instance.stop()
.thenAccept(stopResult -> System.out.printf("Stop result: %s [Native stop result: %s].%n",
stopResult, stopResult.unwrap(Object.class)))));

final Configuration actualConfigurarion = instance.configuration();
final URI uri = UriBuilder.newInstance().scheme(actualConfigurarion.protocol().toLowerCase())
.host(actualConfigurarion.host()).port(actualConfigurarion.port())
.path(actualConfigurarion.rootPath()).build();
instance.stopOnShutdown(stopResult ->
System.out.printf("Stop result: %s [Native stop result: %s].%n", stopResult,
stopResult.unwrap(Object.class)));
final URI uri = instance.configuration().baseUri();
System.out.printf("Instance %s running at %s [Native handle: %s].%n", instance, uri,
instance.unwrap(Object.class));
System.out.println("Send SIGKILL to shutdown.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
*
* @author Markus KARG ([email protected])
* @since 3.1
* @see jakarta.ws.rs.SeBootstrap;
* @see jakarta.ws.rs.SeBootstrap
*/
package jaxrs.examples.bootstrap;
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Response example2() {
* 1-step process: Build Response and add a link directly to it using either a String or a URI.
*
* @return response.
* @throws URISyntaxException
* @throws URISyntaxException if URI is invalid
*/
public Response example3() throws URISyntaxException {
Response r;
Expand Down
Loading

0 comments on commit 7595659

Please sign in to comment.