retrieving tomcat info from within a war

2008-07-23 Thread Jerry Atrick
Is there a way to retrieve tomcat version/info from within a War file? I
actually would prefer this to be web container agnostic, but I'm working
with Tomcat, so that's where I will start.

I know that the manager does almost exactly what I want when going to:
http://localhost:8080/manager/serverinfo

but for the life of me, I can't seem to find it in the src.

Any help would be greatly appreciated.

Cheers
Junos


Re: retrieving tomcat info from within a war

2008-07-24 Thread Johnny Kewl


- Original Message - 
From: "Jerry Atrick" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, July 23, 2008 10:51 PM
Subject: retrieving tomcat info from within a war



Is there a way to retrieve tomcat version/info from within a War file? I
actually would prefer this to be web container agnostic, but I'm working
with Tomcat, so that's where I will start.

I know that the manager does almost exactly what I want when going to:
http://localhost:8080/manager/serverinfo

but for the life of me, I can't seem to find it in the src.


They hide it in a property file

heres the code

   try {
   InputStream is = ServerInfo.class.getResourceAsStream
   ("/org/apache/catalina/util/ServerInfo.properties");
   Properties props = new Properties();
   props.load(is);
   is.close();
   serverInfo = props.getProperty("server.info");
   serverBuilt = props.getProperty("server.built");
   serverNumber = props.getProperty("server.number");
   } catch (Throwable t) {}

The rest of that stuff OS etc is just Java properties

like...

sInfo += "JVM Vendor: " + System.getProperty("java.vm.vendor") + "\n";

etc

I wonder what would happen if you ran this against Glassfish I bet it 
works... coz TC is probably hiding in there somewhere ;)


agnosticism thru theft... ha ha

Have fun..

---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
--- 



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: retrieving tomcat info from within a war

2008-07-24 Thread Jerry Atrick
Awesome, that worked perfectly!


On Thu, Jul 24, 2008 at 5:56 AM, Johnny Kewl <[EMAIL PROTECTED]> wrote:

>
> - Original Message - From: "Jerry Atrick" <[EMAIL PROTECTED]>
> To: 
> Sent: Wednesday, July 23, 2008 10:51 PM
> Subject: retrieving tomcat info from within a war
>
>
>  Is there a way to retrieve tomcat version/info from within a War file? I
>> actually would prefer this to be web container agnostic, but I'm working
>> with Tomcat, so that's where I will start.
>>
>> I know that the manager does almost exactly what I want when going to:
>> http://localhost:8080/manager/serverinfo
>>
>> but for the life of me, I can't seem to find it in the src.
>>
>
> They hide it in a property file
>
> heres the code
>
>   try {
>   InputStream is = ServerInfo.class.getResourceAsStream
>   ("/org/apache/catalina/util/ServerInfo.properties");
>   Properties props = new Properties();
>   props.load(is);
>   is.close();
>   serverInfo = props.getProperty("server.info");
>   serverBuilt = props.getProperty("server.built");
>   serverNumber = props.getProperty("server.number");
>   } catch (Throwable t) {}
>
> The rest of that stuff OS etc is just Java properties
>
> like...
>
> sInfo += "JVM Vendor: " + System.getProperty("java.vm.vendor") + "\n";
>
> etc
>
> I wonder what would happen if you ran this against Glassfish I bet it
> works... coz TC is probably hiding in there somewhere ;)
>
> agnosticism thru theft... ha ha
>
> Have fun..
>
> ---
> HARBOR : http://www.kewlstuff.co.za/index.htm
> The most powerful application server on earth.
> The only real POJO Application Server.
> See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
> ---
>
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>