admin@glassfish.java.net

Host/Port of instance

From: Arun Gupta <arun.p.gupta_at_oracle.com>
Date: Tue, 22 Jun 2010 14:20:50 -0700

I created a simple webapp with a single servlet and a JSP in it and
deployed it on a 2-instance cluster (all on one machine) and front-end
it with mod_jk.

The following values are printed for
localhost:18080/HelloWorld/HelloServlet (with port hopping):

getRemoteAddr: 0:0:0:0:0:0:0:1%0
getRemoteHost: 0:0:0:0:0:0:0:1%0
getRemotePort: 48466
getLocalAddress: 0:0:0:0:0:0:0:1%0
getLocalPort: 18080
getServerName: localhost

and following for localhost/HelloWorld/HelloServlet (with mod_jk front end):

getRemoteAddr: ::1
getRemoteHost: ::1
getRemotePort: -1
getLocalAddress: null
getLocalPort: 80
getServerName: localhost

Standard Servlet APIs are used to print these values.

Other than looking at mod_jk logs, how do I find out which instance is
serving the request ?

Is there a system property or API that can be used to print these
details in a Servlet ?

Thanks,
-Arun
-- 
Blog: http://blogs.sun.com/arungupta
Twitter: http://twitter.com/arungupta