KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > http > Version


1 // ========================================================================
2
// $Id: Version.java,v 1.16 2004/10/20 12:46:20 gregwilkins Exp $
3
// Copyright 199-2004 Mort Bay Consulting Pty. Ltd.
4
// ------------------------------------------------------------------------
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
// ========================================================================
15

16 package org.mortbay.http;
17
18
19 /* ------------------------------------------------------------ */
20 /** Jetty version.
21  *
22  * This class sets the version data returned in the Server and
23  * Servlet-Container headers. If the
24  * java.org.mortbay.http.Version.paranoid System property is set to
25  * true, then this information is suppressed.
26  *
27  * @version $Revision: 1.16 $
28  * @author Greg Wilkins (gregw)
29  */

30 public class Version
31 {
32     private static boolean __paranoid =
33         Boolean.getBoolean("org.mortbay.http.Version.paranoid");
34     
35     private static String JavaDoc __Version="Jetty/5.1";
36     private static String JavaDoc __VersionImpl=__Version+".x";
37     private static String JavaDoc __VersionDetail="Unknown";
38     private static String JavaDoc __notice = "This application is using software from the "+
39         __Version+
40         " HTTP server and servlet container.\nJetty is Copyright (c) Mort Bay Consulting Pty. Ltd. (Australia) and others.\nJetty is distributed under an open source license.\nThe license and standard release of Jetty are available from http://jetty.mortbay.org\n";
41
42     static
43     {
44         updateVersion();
45     }
46     
47     public static String JavaDoc getVersion() {return __Version;}
48     public static String JavaDoc getImplVersion() {return __VersionImpl;}
49     public static String JavaDoc getDetail() {return __VersionDetail;}
50     public static boolean isParanoid(){return __paranoid;}
51
52     public static void main(String JavaDoc[] arg)
53     {
54         System.out.println(__notice);
55         System.out.println("org.mortbay.http.Version="+__Version);
56         System.out.println("org.mortbay.http.VersionImpl="+__VersionImpl);
57         System.out.println("org.mortbay.http.VersionDetail="+__VersionDetail);
58     }
59
60     public static void updateVersion()
61     {
62         Package JavaDoc p = Version.class.getPackage();
63         if (p!=null && p.getImplementationVersion()!=null)
64             __VersionImpl="Jetty/"+p.getImplementationVersion();
65         
66         if (!__paranoid)
67         {
68             __VersionDetail=__VersionImpl+
69                 " ("+System.getProperty("os.name")+
70                 "/"+System.getProperty("os.version")+
71                 " "+System.getProperty("os.arch")+
72                 " java/"+System.getProperty("java.version");
73         }
74     }
75 }
76
77
Popular Tags