Determining the client IP

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Determining the client IP

Alan Williamson
Okay, i have pretty gleamed everything I need from the Request object
that I need.  Except the remote IP address.

These returns null

        req.remoteAddr()
        req.remoteHost()

I am hitting it from the local machine.

Am i looking for it in the right place?  If not, then where?

thanks

a

--
Alan Williamson
  "a wiki -and- a blog" @ http://www.Blog-City.com/

  b: http://alan.blog-city.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Determining the client IP

Jeanfrancois Arcand-2


Alan Williamson wrote:
> Okay, i have pretty gleamed everything I need from the Request object
> that I need.  Except the remote IP address.

Great :-)

>
> These returns null
>
>     req.remoteAddr()
>     req.remoteHost()
>
> I am hitting it from the local machine.
>
> Am i looking for it in the right place?  If not, then where?

OK that one is a little tricky (and docs completely missing). By
default, we aren't setting those variables to avoid IO level call. So
what you need to add is:

request.action(ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE);
request.action(ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE);
request.action(ActionCode.ACTION_REQ_HOST_ATTRIBUTE);
request.action(ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE);

and then invoke the method you described above.

Let me know if that doesn't work.

Thanks!

-- Jeanfrancois

>
> thanks
>
> a
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Determining the client IP

Alan Williamson
>> Am i looking for it in the right place?  If not, then where?
>
> OK that one is a little tricky (and docs completely missing). By
> default, we aren't setting those variables to avoid IO level call. So
> what you need to add is:
>
> request.action(ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE);
> request.action(ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE);
> request.action(ActionCode.ACTION_REQ_HOST_ATTRIBUTE);
> request.action(ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE);
>
> and then invoke the method you described above.
>
> Let me know if that doesn't work.

Once again, Grizzly when looks down, picks itself up and dusts itself off!

Perfect.  I only need the remote host.  I had to pass in a null param,
as there wasn't a signature matching the one you indicated.

    request.action(ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE, null);


Well, i think thats me done with all the questions for Tuesday!  ;)

Thank you Jeanfrancois, appreciate the fast response.

--
Alan Williamson
  "a wiki -and- a blog" @ http://www.Blog-City.com/

  b: http://alan.blog-city.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]