From a4c161ea3258dc4d4ea397552f9f1e9495723c65 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Thu, 1 Sep 2022 18:31:13 +0300 Subject: [PATCH] Add first implementations of new JAX-RS 3.1 APIs (cherry picked from commit 9134fa862c35ee77095ffe0cb69f67e817ff3acd) (cherry picked from commit 7bfb03f26fcded57195a7e35653a515a3b46f662) --- .../common/jaxrs/RuntimeDelegateImpl.java | 29 +++++++++++++++++++ .../server/jaxrs/SseBroadcasterImpl.java | 15 +++++++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/RuntimeDelegateImpl.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/RuntimeDelegateImpl.java index 50bb0723098ad..efa84eb922653 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/RuntimeDelegateImpl.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/RuntimeDelegateImpl.java @@ -3,10 +3,13 @@ import java.util.Date; import java.util.Locale; import java.util.ServiceLoader; +import java.util.concurrent.CompletionStage; +import jakarta.ws.rs.SeBootstrap; import jakarta.ws.rs.core.Application; import jakarta.ws.rs.core.CacheControl; import jakarta.ws.rs.core.Cookie; +import jakarta.ws.rs.core.EntityPart; import jakarta.ws.rs.core.EntityTag; import jakarta.ws.rs.core.Link; import jakarta.ws.rs.core.MediaType; @@ -115,4 +118,30 @@ public HeaderDelegate createHeaderDelegate(Class type) throws IllegalA public Link.Builder createLinkBuilder() { return new LinkBuilderImpl(); } + + @Override + public SeBootstrap.Configuration.Builder createConfigurationBuilder() { + // RR does not implement currently implement the bootstrapping API + throw new UnsupportedOperationException("Pending implementation"); + } + + @Override + public CompletionStage bootstrap(Application application, + SeBootstrap.Configuration configuration) { + // RR does not implement currently implement the bootstrapping API + throw new UnsupportedOperationException("Pending implementation"); + } + + @Override + public CompletionStage bootstrap(Class aClass, + SeBootstrap.Configuration configuration) { + // RR does not implement currently implement the bootstrapping API + throw new UnsupportedOperationException("Pending implementation"); + } + + @Override + public EntityPart.Builder createEntityPartBuilder(String s) throws IllegalArgumentException { + // TODO: figure out how to implement this + throw new UnsupportedOperationException("Pending implementation"); + } } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java index aa0c0f5c4d74a..b41366992d283 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java @@ -61,13 +61,20 @@ private void checkClosed() { } @Override - public synchronized void close() { + public void close() { + close(true); + } + + @Override + public synchronized void close(boolean cascading) { if (isClosed) return; isClosed = true; - for (SseEventSink sink : sinks) { - // this will in turn fire close events to our listeners - sink.close(); + if (cascading) { + for (SseEventSink sink : sinks) { + // this will in turn fire close events to our listeners + sink.close(); + } } }