users@jersey.java.net

Re: [Jersey] Need HttpServletRequest in ContainerRequestFilter

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 20 Jan 2009 17:47:34 +0100

On Jan 20, 2009, at 5:22 PM, Babu Naidu wrote:

> Hi,
>
> I have a requirement that requires HttpServletRequest within the
> filter method (of ContainerRequestFilter), is there a way to get
> hold of the HttpServletRequest instance in the filter method?
>

Yes, inject:

  @Context HttpServletRequest request

on a field or the constructor of the filter.

Paul.

> If not, would it be possible to make filter method's method params
> as var arg? so that I can use @Context annotation to have
> HttpServletRequest injected into filter method.
>
> Thanks
> Babu