Re: Programmatic Lookup of @Context items

Jason Lee

Right, but I'm building JAX-RS resources programmatically, ultimately calling the consuming method (which happens to be a Kotlin function) via MethodHandler.Builder.handledBy(Inflector). It may well be I have to rethink how all of that is handled, but I was hoping I would be able to grab those various @Context objects programmatically (easily) while dispatching the call to the Kotlin function.

On 4/21/2018 1:54 AM, Ondrej Mihályi wrote:
Injection via Context  also works in Java SE if you register resources as classes, becaus3 Jersey instantiates them and injects needed values when a request is handled.

If you instantiate resource classes yourself and register created objects with Jersey, injection would still work if you inject with Context a value as a method parameter. Jersey executes the method and injects needed values.

So in short, injection in resource classes works also in Java SE.


Dňa so 21. 4. 2018, 7:40 Jason Lee <jason@...> napísal(a):
Long story short, I find myself in need of being able to lookup manually those objects normally injected vi @Context (or @Inject) in a Java SE environment. I've been digging through the Jersey and JAX-RS docs, but nothing's standing out. Can someone give me a nudge in the right direction?


jason lee

Jason Lee

Join to automatically receive all group messages.