Inside a WAR deployed to a server, I have a java utility type class (not servlet). I want to identify the server name inside this java class. How can I do that ?
Seems to me that "localhost" always points at the machine where the code is running. But perhaps you don't need a name which you'll use if you're going to make a TCP/IP connection to that machine? Perhaps you need it for some other purpose?
If you're gonna buy things, buy this thing and I get a fat kickback:
Free, earth friendly heat - from the CodeRanch trailboss