hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From angelogeminiani <angelo.gemini...@gmail.com>
Subject Re: HttpServer: How to get Client IP
Date Sun, 04 Sep 2011 13:24:43 GMT



olegk wrote:
> 
> On Fri, 2011-09-02 at 08:22 -0700, angelogeminiani wrote:
>> Hi,
>> I'm writing an HTTP server and I need client IP.
>> I'm using httpcore 4.1.3.
>> In Servlets it's easy: request.getRemoteAddr().
>> Is there similar method in HttpRequest, or a way to retrieve client IP
>> from
>> server?
>> 
> 
> You can cast any instance of the HttpConnection interface to
> HttpInetConnection in order to get access to IP address of its
> endpoints:  
> 
> http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpInetConnection.html
 
> 
> Oleg
> 

Thank you Olegk for your help.
I'm writing a server starting from 
http://hc.apache.org/httpcomponents-core-ga/httpcore-nio/examples/org/apache/http/examples/nio/NHttpServer.java
and need Client IP in file handler.
Where can I get a HttpConnection instance?
Is there any in HttpRequest?
I need IP of client in HttpFileHandler.
Thak you.

-- 
View this message in context: http://old.nabble.com/HttpServer%3A-How-to-get-Client-IP-tp32387476p32395852.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message