• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to find server name

 
Eivind Rasmussen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
does anybody know how to find the server-name (in the code) of the server im running my java-program on. I've tried all the System-properties, but still cant fint the server-name.
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most servers set it in the response header. The header is called "Server".
 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use getServletName() method
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by danny liu:
Use getServletName() method

Server name, not Servlet name...
 
Satya Komirisetti
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this
request.getServerName();
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eivind are you refering to the container server name or the host server name?
If host name: do as Satya said.
If container server name: look in the response header
 
Alessandro Danesi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can retrieve container server name as:
ServletContext ctx = session.getServletContext();
ctx.getServerInfo();
 
Vishwa Bandhu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to find out what is the WAN IP of the network from within the network? I mean, I am running a java program on my desktop, which is connected to a router, and can I find the Internet IP address for the network from the router...?
Thank you.
[ May 03, 2004: Message edited by: Chidananda Kakunje ]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are assuming that all networks are simple ones. Mine aren't. They have multiple NICs attached to different LAN segments and may go out through different routers over differen WANs to different ISPs.
Actually, what good does knowing the WAN address do anyway? The WAN is just the pipe to the Internet at large.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic