Closed thanhlq closed 8 years ago
I once wrote such User injector. It's open source. To start take a look at this: https://github.com/eclipsesource/connect/blob/master/bundles/com.eclipsesource.connect.inject/src/com/eclipsesource/connect/inject/ConnectInjectionFeature.java
This feature is registered as OSGi service. Hope this helps. Will close this issue because it's not an issue for the connector ;). Please feel free to reopen if you have any further questions.
Ok thanks very much for your sharing! I will look at your code.
Hi, today I am trying to inject some custom object to a rest service but I am failed. Here is my code:
Suppose that I want to inject an object named UserContextInfo into my rest service as following:
During the authentication process (AuthenticationHandler), I set the uci variable into the ContainerRequestContext like this:
The UserContextInfoFactory.java
The UserContextInfoFactoryRegistration.java
During the debug, the uci is always null. Even that I can get the UserContextInfo object from HttpServletRequest.getAttribute("uci").
Thanks so much for your help to make this work...
Reference: https://jersey.java.net/documentation/latest/ioc.html#d0e15163