The approach you're using is causing this error because, when using the @PreMatching filter, it is expected that the actions are non-blocking, since the event loop is always used for these operations. The operation of reading the InputStream within the ContainerRequestContext is blocking, and since it is executed in the event loop, the org.jboss.resteasy.reactive.common.core.BlockingNotAllowedException is thrown.
Considering the exception being thrown and the purpose of the filter you mentioned in a previous comment, I believe a possible solution to the problem is as follows:
package com.example;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.logging.Logger;
import org.jboss.resteasy.reactive.server.ServerRequestFilter;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.vertx.core.http.HttpServerRequest;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.PreMatching;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.ext.Provider;
@Provider
public class TesteFilter {
private static final Logger LOGGER = Logger.getLogger(TesteFilter.class.getName());
@Context
HttpServerRequest request;
@ServerRequestFilter
public void doFilter(ContainerRequestContext containerRequestContext) throws IOException {
LOGGER.info("Intercepting the request in the Filter");
String body = new String(containerRequestContext.getEntityStream().readAllBytes());
LOGGER.info("Original request body: " + body);
ObjectMapper mapper = new ObjectMapper();
Language language = mapper.readValue(body, Language.class);
String modifiedBody = mapper.writeValueAsString(
new Language("Modified-" + language.getType(),
"Modified-" + language.getName()
));
LOGGER.info("Modified request body: " + modifiedBody);
containerRequestContext.setEntityStream(new ByteArrayInputStream(modifiedBody.getBytes()));
}
}
Here’s the Quarkus documentation covering this topic: Request or response filters - Quarkus Documentation
Lastly, but no less important, you mention that you're using Quarkus version 3.8.6.redhat-00005, which leads me to believe that you already have a subscription to the Red Hat Build of Quarkus. Don’t hesitate to open a support ticket with Red Hat to get help with issues like this.