users@jersey.java.net

Re: [Jersey] _at_GET and _at_Context HttpServletRequest

From: Igor Minar <iiminar_at_gmail.com>
Date: Thu, 11 Jun 2009 15:00:40 -0700

On Jun 11, 2009, at 5:46 AM, Paul Sandoz wrote:

>
> On Jun 11, 2009, at 2:29 PM, Igor Minar wrote:
>
>> Hi there,
>>
>> I'm curious as to why it is illegal to inject request as a method
>> parameter for methods annotated with @GET.
>>
>
> You can do this:
>
> @GET
> public String get(@Context HttpServletRequest hsr) {
> String remoteAddress = hsr.getRemoteAddr();
> }
>

That's what I tried, but I'm getting an error that such a method is an
illegal/invalid method for given http method. I'm using 1.1.0-ea.

/i


> Does the above not work for you? if so what version of Jersey are
> you using?
>
> Paul.
>
>
>> I'm trying to get the remote ip address of the client for my GET
>> method and I can't figure out how to do it without the request
>> instance.
>>
>> Am I overlooking something?
>>
>> thanks a log!
>>
>> /i
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>