users@glassfish.java.net

Re: How to get glassfish host info for deployed application?

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Fri, 02 Mar 2007 13:36:38 -0800

Hi,

I was about to say the same about the host. Now for the port this is not
simple as you cannot have access to the Socket. I can probably told you
how to hook inside GlassFish code from your Servlet, but it will means
your Servlet will only works in GlassFish. What do you think?

-- Jeanfrancois

glassfish_at_javadesktop.org wrote:
> I can partially answer my own question. Nothing to do with glassfish.
>
> I can use
>
> hostName = InetAddress.getLocalHost().getHostName();
>
> to get the host name (although in my local network environment, my Mac OS X is identified with a bogus host name) and
>
> ipAddress = InetAddress.getLocalHost().getHostAddress();
>
> to get the IP address -- this seems to be accurate even for my Mac.
>
> Adding InetAddress and associated exceptions to my import list of course.
>
> This does not give me the port that the wrapping app server is running on.
>
> But at least this is a start to tell running instances apart.
> [Message sent by forum member 'jjsban' (jjsban)]
>
> http://forums.java.net/jive/thread.jspa?messageID=206020
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>