Replies: 1 comment
-
|
Hey, yeah – RESTEasy classic + Vert.x is painful with @context once you hit @suspended / async. Classic relies way too much on ThreadLocals, so when the request gets paused and resumed (often on a different event-loop thread), the context disappears.
If you’re stuck on classic: Don’t inject @context stuff (headers, UriInfo, etc.) directly inside the async method. Or only inject safe things like Application, Providers, Configuration that don’t break on thread change. Most people either go reactive or just capture stuff upfront. If you tell me exactly which @context types are failing, I can give a more pinpoint fix. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm using RestEasy with Vert.x.
I have a ContextInjector (https://github.com/Yaytay/vertx-resteasy-helpers/blob/main/src/main/java/uk/co/spudsoft/vertx/rest/RoutingContextInjector.java) that works just fine if the request has never been paused, but if the request gets paused the proxy loses the context (my guess is that there are ThreadLocals somewhere, but I don't know this for sure).
Is it possible to write a ContextInjector that works regardless of thread?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions