Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] How to get listen address after a HttpClient request?

Dear Thomas,

 

Thanks!!

It’s a good idea I never thought to let the remote server response a HttpServletRequest.getRemoteAddr().

 

My application has a function to show the local IP in the UI. And my application will run on Server PC.

In case that there may be many network cards installed in a Server PC. I don’t know to show which local IP in the UI.

My application has another function to monitor remote HTTP server status.

So I try to use Jetty HttpClient to achieve the function and hope it can get the correct local IP when a http connection established.

Therefore I will have the local IP to show in UI, the users, almost MIS, will know my application use which IP to monitor remote HTTP server.

And this help them to easily tune IPs if they needed.

 

For the reason I may not have the control of remote HTTP server (using Servlets, to response HttpServletRequest.getRemoteAddr()), I still need a method to get local IP after a successful http request connected.

 

Hope this describes the situation I occurred clearly.

 

Thanks in advance.

 

Sincerely,

Micky

 

From: jetty-users-bounces@xxxxxxxxxxx [mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Thomas Becker
Sent: Tuesday, January 04, 2011 7:48 PM
To: JETTY user mailing list
Subject: Re: [jetty-users] How to get listen address after a HttpClient request?

 

Micky, could you please tell us more on how your clients connect to your application? Are you using plain Servlets? Then you will be able to get the client IP address from the HttpServletRequest (http://download.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html) object passed to your servlet's doGet|doPost|service|... method.

HttpServletRequest.getRemoteAddr().

Hope that helps.

On 03/01/2011 10:07, Micky Lee wrote:

Dear Thomas,

 

 

It’s great to log the request and know the client IP address for me.

 

But what I need is my program need to show this client IP in my application UI.

I have no way to directly get that IP.

 

Thanks in advance.

 

Sincerely,

Micky

 

 

From: jetty-users-bounces@xxxxxxxxxxx [mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Thomas Becker
Sent: Monday, January 03, 2011 3:50 PM
To: JETTY user mailing list
Subject: Re: [jetty-users] How to get listen address after a HttpClient request?

 

Hi Micky,

if I got your request right you want to have a request log, logging each client's request with client ip address and some additional information.

Then this HowTo will help you to enable it:
http://wiki.eclipse.org/Jetty/Howto/Configure_Request_Logs

If you've any further questions or if this is not what you're asking for, don't hesitate to ask the list again.

Cheers,
Thomas

On 03/01/2011 03:33, Micky Lee wrote:

Dear all,

 

 

I want to get the local listen address of a request of HttpClient.

It means after a successful GET/POST request by using HttpClient, I want to get the connecting local address. (listen address too)

 

I didn’t find any document or API described it.

 

Can anyone help me?

 

Sincerely,

Micky

 

 

 
 
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users
 
 
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users

Back to the top