users@glassfish.java.net

Glassfish global variables ?

From: <glassfish_at_javadesktop.org>
Date: Thu, 17 Jul 2008 10:28:10 PDT

I have some web apps that need access to the hostname of the application server they reside on. I was wondering if there was a way to create a global variable on the application server, that contained the hostname of the server, so that these web applications could reference it. There are some options that I've considered, but they don't seem as "clean" as I would like:

a) JNDI. I don't want to use because I have to create a resource and a factory for the resource which seems overly complex for a simple String variable.
b) Using "java.net.InetAddress.getLocalHost();" This seems largely OS dependent, and sometimes returns fully qualified names and sometimes not--not something I can consistently rely upon.

So, does anyone have a good method? Or, does anyone see a fairly efficient way of using either of those methods I just described?
[Message sent by forum member 'wfsaxton' (wfsaxton)]

http://forums.java.net/jive/thread.jspa?messageID=287364