Closed parassingla18 closed 9 years ago
I think the @Context only works within Resources and feature or am I wrong?
Thanks for your quick reply. So, Is there any other way of intercepting the HttpServletRequest before it goes to the REST API ?
I want to intercept each GET/POST request that is being made to my resource and perform some operations on HttpServletRequest object. Please suggest me a way to do it. Further Is it possible to extend the Jersey's default ServletContainer class so that i can perform the operations in Service() method?
What's missing in the passed ContainerRequestContext
? We use it to look for headers and cookies.
Regarding the service() method I think this is not possible right now.
Let say we want to get the attributes which are present in HttpSession. How do we get that using ContainerRequestContext?
For eg: i need to fetch an attribute from the session called username. i can do that using following code snippet.
HttpSession session = req.getSession();// where req. is HttpServletRequest. String username = (String)session.getAttribute("username");
How can i achieve the same using ContainerRequestContext object?
Hmm, I see. Can you try to annotate the MySecurityHandler
with @Provider
and registering it as OSGi service. After this please try to inject the HttpServletRequest
with the @Context
annotation again. Please leave a message if this has worked ;).
Will close this issue. Please reopen if the problem still exists.
This is probably not connected with osgi-jax-rs-connector, but I don't know where to ask about problems with Jersey in OSGi container.
I try to use @Context HttpServletRequest
field injection in ContainerResponseFilter
service (which is registered as a @Provider
and is working OK without this field).
Just after adding the field and restarting my bundle I get only
Jersey is not ready yet
There is no single line of any problems in logs and I don't know where to look. Any ideas?
Is there any update on this issue. Still facing this issue. Please help, if any fix available
Hi,
I have followed your security integration example and i am trying to override the following method public Principal authenticate(ContainerRequestContext requestContext) {}
While doing so, i need to fetch the HttpServletRequest object in order to fetch the session and other attributes in it. I have tried injecting it in my securityHandler() using @Context annotation but it is always returning null.
Following is the code snippet i am using.
But my servletRequest object is always null.
Any Suggestion/Recommendation in the above issue will be a lot of help.
Regards, Paras