package sun.rmi.transport.proxy; import java.net.UnknownHostException; import java.net.InetAddress; final class CGITryHostnameCommand implements CGICommandHandler { CGITryHostnameCommand() { } @Override public String getName() { return "tryhostname"; } @Override public void execute(String s) { System.out.println("Status: 200 OK"); System.out.println("Content-type: text/html"); System.out.println(""); System.out.println("Java RMI Server Hostname Info"); System.out.println("

Java RMI Server Hostname Info

"); System.out.println("

Local host name available to Java VM:

"); System.out.print("

InetAddress.getLocalHost().getHostName()"); try { System.out.println(" = " + InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException ex) { System.out.println(" threw java.net.UnknownHostException"); } System.out.println("

Server host information obtained through CGI interface from HTTP server:

"); System.out.println("

SERVER_NAME = " + CGIHandler.ServerName); System.out.println("

SERVER_PORT = " + CGIHandler.ServerPort); System.out.println(""); } }