diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/NewParamsRestResource.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/NewParamsRestResource.java index c256197872b42..fcb4aa7203ca0 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/NewParamsRestResource.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/NewParamsRestResource.java @@ -28,6 +28,8 @@ import org.jboss.resteasy.reactive.server.spi.ServerRequestContext; import org.junit.jupiter.api.Assertions; +import io.quarkus.runtime.BlockingOperationControl; +import io.smallrye.common.annotation.Blocking; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerResponse; @@ -54,6 +56,16 @@ public String params(@RestPath String p, + q2.orElse("empty") + ", q3: " + q3.orElse(-1); } + @Blocking + @POST + @Path("form-blocking") + public String formBlocking(@RestForm String f) { + if (!BlockingOperationControl.isBlockingAllowed()) { + throw new RuntimeException("should not have dispatched"); + } + return f; + } + @GET @Path("context") public String context(// Spec: diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestTestCase.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestTestCase.java index 3e5f43bbe5fdc..0674a2405a95e 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestTestCase.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestTestCase.java @@ -390,6 +390,12 @@ public void testNewParams() { .then() .log().ifError() .body(Matchers.equalTo("data:OK\n\n")); + RestAssured.with() + .urlEncodingEnabled(false) + .formParam("f", "fv") + .post("/new-params/myklass;m=mv/myregex/form-blocking") + .then() + .body(Matchers.equalTo("fv")); } @Test diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java index 42af56e7375da..5aa1ad3c8aab2 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java @@ -24,7 +24,8 @@ public abstract class AbstractResteasyReactiveContext properties; private final ThreadSetupAction requestContext; private ThreadSetupAction.ThreadState currentRequestScope; @@ -55,11 +56,19 @@ public synchronized void resume(Executor executor) { this.executor = executor; if (executor == null) { suspended = false; + } else { + this.lastExecutor = executor; } } else { suspended = false; if (executor == null) { - getEventLoop().execute(this); + if (lastExecutor == null) { + getEventLoop().execute(this); + } else { + // we need to do this to ensure that if we suspended while not on the event-loop, + // that we come back on a thread from this executor + lastExecutor.execute(this); + } } else { executor.execute(this); }