There are cases where you may need something from HttpServletRequest that
isn't present in ContainerRequestContext. For example, if you wanted to
look at the remote address of the request, I see no way of finding that
information in ContainerRequestContext. There are other methods that
aren't available in ContainerRequestContext that are available in
HttpServletRequest (and in turn ServletRequest) as well, unless I just
don't know where to look for them.
I don't mind raising a bug ticket myself, but I thought it was worth
pointing out that this was possible with Jersey 1.x. I don't think using
ResourceContext is the right way to go about getting that data, but to each
their own.
On Tue, Jun 18, 2013 at 10:00 AM, Marek Potociar
<marek.potociar_at_oracle.com>wrote:
> Hi Ashwin,
>
> while the behavior that you describe is an obvious bug (please file a new
> issue in https://java.net/jira/browse/jersey ), why are you trying to
> inject the Request in your filter? All the information that Request API
> provides is passed to the filter method as part of the filter context
> instance.
>
> Marek
>
> On Jun 18, 2013, at 5:34 PM, Ashwin Ravindran <ashw.reddi_at_gmail.com>
> wrote:
>
> Hey,
>
> I am using Jersey 2.0 and not able to inject Request object into my
> filter. I am getting java.lang.IllegalStateException: Not inside a
> request scope this error while trying to inject. Please let me know whether
> there is any work around for this issue
>
> --
> Thanks
> Ashwin
>
>
>