This content has been marked as final.
Show 5 replies
-
1. Re: UriInfo always null when using @Context
nickarls Aug 21, 2012 2:09 AM (in response to slowdive)1 of 1 people found this helpfulIs the @Context UriInfo available if used as a method parameter?
-
2. Re: UriInfo always null when using @Context
slowdive Aug 21, 2012 11:46 AM (in response to nickarls)Thanks a bunch! Making it a method parameter solved the problem. Strange that it wouldn't work as a member variable though.
-
3. Re: UriInfo always null when using @Context
nickarls Aug 21, 2012 2:53 PM (in response to slowdive)Don't know. 5.2.2 of the spec says
An instance of UriInfo can be injected into a class field or method parameter using the @Context annotation
-
4. Re: UriInfo always null when using @Context
nickarls Aug 23, 2012 2:17 AM (in response to nickarls)Tried a simple
@Path("/status")
public class Status
{
@Context
UriInfo info;
and put a breakpoint in one my called methods and I did manage to get a non-null instance on 7.1.1 so it's not a direct bug, I think
-
5. Re: UriInfo always null when using @Context
slowdive Aug 24, 2012 11:40 AM (in response to nickarls)Well, I thought this was resolved, but now I am seeing inconsistent results. In summary
- We are using the CXF JAX-RS implementation
- If I use the context annotation for a member variable, it is always null
- If I use it as a method parameter, sometimes it is null, and sometimes it is not. I could not determine a clear pattern for what is causing it to be one way or another.
- Either way works fine in Weblogic