Do you have a producer for your EntityManager?
Well, I think so. Just to be sure: You mean the factory which generates the instance, don't you?
I think the @Provider gets executed before Seam's BijectionFilter, that's why the EntityManager is null.
What exactly are you trying do ?
Personaly, I don't think it's a good way to use the EntityManager inside a Rest Provider class. The provider should handle the (un-)marshalling and pass the result to the next filter/component in the chain (which then should handle the authentication logic).
Yeah, this might be the cause. How would you implement an authentication method using an existing Seam entity and RESTEasy?
I'd like to use signed and stateless requests. E.g.:
GET /seam/resource/rest/service/foobar HTTP/1.1 Host: foobar.com Authorization: API [SHA512-hashed request]
The hash is calculated from a concatenation of the username, the query and a secret key.
How would you implement such an authentication procedure?
Did you try calling Lifecyle.begin() and Lifecyle.end() in your method (in the preprocessor) ?
Between these methods you should be able to lookup for the EntityManager as follows:
EntityManager em = (EntityManager) Component.getInstance("entityManager");
Thank you very much!
Lifecycle.begin()solved the issue.