- What I've tried:
inject CurrentVertxRequest
context and then get body from there
@Path("/map_event")
public class MapEventApi {
@Inject
CurrentVertxRequest reqContext;
@POST
@Consumes({ "application/json" })
@Produces({ "application/json" })
Response create(@Valid MapEvent mapEvent, @Context SecurityContext securityContext) throws Exception {
String body = reqContext.getCurrent().getBodyAsString();
...
}
}
but this will give a warning:
2022-01-25 18:22:08,854 WARN [null:-1] (executor-thread-0) BodyHandler in not enabled on this route: RoutingContext.getBodyAsString(...) in always be NULL
- another try:
inject standard JaxRS HttpServletRequest
context
@Context HttpServletRequest
will get this error:
org.jboss.resteasy.spi.LoggableFailure: RESTEASY003880: Unable to find contextual data of type: javax.servlet.http.HttpServletRequest
at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:155)
at com.sun.proxy.$Proxy97.getInputStream(Unknown Source)
I guess it's because quarkus use vertx under the hood so injecting regular jaxrs context won't work since it's not the same thread.