Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in release-4.0 branch #1176

Merged
merged 4 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
spericas marked this conversation as resolved.
Show resolved Hide resolved
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
Loading