01: /*
02: * Copyright 1999,2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.apache.catalina.util;
18:
19: import java.io.InputStream;
20: import java.util.Properties;
21:
22: /**
23: * Simple utility module to make it easy to plug in the server identifier
24: * when integrating Tomcat.
25: *
26: * @author Craig R. McClanahan
27: * @version $Revision: 1.2.2.1 $ $Date: 2004/08/24 12:25:03 $
28: */
29:
30: public class ServerInfo {
31:
32: // ------------------------------------------------------- Static Variables
33:
34: /**
35: * The server information String with which we identify ourselves.
36: */
37: private static String serverInfo = null;
38:
39: static {
40:
41: try {
42: InputStream is = ServerInfo.class
43: .getResourceAsStream("/org/apache/catalina/util/ServerInfo.properties");
44: Properties props = new Properties();
45: props.load(is);
46: is.close();
47: serverInfo = props.getProperty("server.info");
48: } catch (Throwable t) {
49: ;
50: }
51: if (serverInfo == null)
52: serverInfo = "Apache Tomcat";
53:
54: }
55:
56: // --------------------------------------------------------- Public Methods
57:
58: /**
59: * Return the server identification for this version of Tomcat.
60: */
61: public static String getServerInfo() {
62:
63: return (serverInfo);
64:
65: }
66:
67: public static void main(String args[]) {
68: System.out.println("Version: " + getServerInfo());
69: }
70:
71: }
|