1 17 18 19 package org.apache.catalina.util; 20 21 22 import java.io.InputStream ; 23 import java.util.Properties ; 24 25 26 33 34 public class ServerInfo { 35 36 37 39 40 43 private static String serverInfo = null; 44 45 48 private static String serverBuilt = null; 49 50 53 private static String serverNumber = null; 54 55 static { 56 57 try { 58 InputStream is = ServerInfo.class.getResourceAsStream 59 ("/org/apache/catalina/util/ServerInfo.properties"); 60 Properties props = new Properties (); 61 props.load(is); 62 is.close(); 63 serverInfo = props.getProperty("server.info"); 64 serverBuilt = props.getProperty("server.built"); 65 serverNumber = props.getProperty("server.number"); 66 } catch (Throwable t) { 67 ; 68 } 69 if (serverInfo == null) 70 serverInfo = "Apache Tomcat"; 71 if (serverBuilt == null) 72 serverBuilt = "unknown"; 73 if (serverNumber == null) 74 serverNumber = "5.5.0.0"; 75 76 } 77 78 79 81 82 85 public static String getServerInfo() { 86 87 return (serverInfo); 88 89 } 90 91 94 public static String getServerBuilt() { 95 96 return (serverBuilt); 97 98 } 99 100 103 public static String getServerNumber() { 104 105 return (serverNumber); 106 107 } 108 109 public static void main(String args[]) { 110 System.out.println("Server version: " + getServerInfo()); 111 System.out.println("Server built: " + getServerBuilt()); 112 System.out.println("Server number: " + getServerNumber()); 113 System.out.println("OS Name: " + 114 System.getProperty("os.name")); 115 System.out.println("OS Version: " + 116 System.getProperty("os.version")); 117 System.out.println("Architecture: " + 118 System.getProperty("os.arch")); 119 System.out.println("JVM Version: " + 120 System.getProperty("java.runtime.version")); 121 System.out.println("JVM Vendor: " + 122 System.getProperty("java.vm.vendor")); 123 } 124 125 } 126 | Popular Tags |