home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VPage / Java.bin / CLASSES.ZIP / sun / rmi / transport / proxy / CGITryHostnameCommand.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-07-08  |  1.9 KB  |  33 lines

  1. package sun.rmi.transport.proxy;
  2.  
  3. import java.net.InetAddress;
  4. import java.net.UnknownHostException;
  5.  
  6. final class CGITryHostnameCommand implements CGICommandHandler {
  7.    public String getName() {
  8.       return "tryhostname";
  9.    }
  10.  
  11.    public void execute(String var1) {
  12.       System.out.println("Status: 200 OK");
  13.       System.out.println("Content-type: text/html");
  14.       System.out.println("");
  15.       System.out.println("<HTML><HEAD><TITLE>Java RMI Server Hostname Info</TITLE></HEAD><BODY>");
  16.       System.out.println("<H1>Java RMI Server Hostname Info</H1>");
  17.       System.out.println("<H2>Local host name available to Java VM:</H2>");
  18.       System.out.print("<P>InetAddress.getLocalHost().getHostName()");
  19.  
  20.       try {
  21.          String var2 = InetAddress.getLocalHost().getHostName();
  22.          System.out.println(" = " + var2);
  23.       } catch (UnknownHostException var3) {
  24.          System.out.println(" threw java.net.UnknownHostException");
  25.       }
  26.  
  27.       System.out.println("<H2>Server host information obtained through CGI interface from HTTP server:</H2>");
  28.       System.out.println("<P>SERVER_NAME = " + CGIHandler.ServerName);
  29.       System.out.println("<P>SERVER_PORT = " + CGIHandler.ServerPort);
  30.       System.out.println("</BODY></HTML>");
  31.    }
  32. }
  33.