You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bob DeRemer <bo...@thingworx.com> on 2011/10/25 13:33:59 UTC

HOW TO detect what app server you're running in

I may need to use some Tomcat-specific code in my web app.  As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic.   If anyone knows how best to do this, ideally with some sample java code, that'd be great.

Thanks,
Bob

Re: HOW TO detect what app server you're running in

Posted by Pid * <pi...@pidster.com>.
On 26 Oct 2011, at 12:47, Konstantin Kolinko <kn...@gmail.com> wrote:

> Note, that this method is unreliable.
>
> 1) The actual value can be configured by server administrator.
> 2) There are 3-rd party repackaged distributions of Tomcat, which
> may/should change the value.
>
> It would be better to rely on presence of certain features that you
> are going to use, or let the user configure your webapp.

It


>
> Best regards,
> Konstantin Kolinko
>
> 2011/10/25 Bob DeRemer <bo...@thingworx.com>:
>> Yeah, that should do it - should have remembered that - I'm already using this - purely for diagnostic info.
>>
>> Thanks, guys!
>>
>> -----Original Message-----
>> From: Ronald Klop (Mailing List) [mailto:ronald-mailinglist@base.nl]
>> Sent: Tuesday, October 25, 2011 7:39 AM
>> To: Tomcat Users List
>> Subject: Re: HOW TO detect what app server you're running in
>>
>> Does this help?
>>
>>     public void doGet(HttpServletRequest request, HttpServletResponse response)
>>             throws ServletException, IOException {
>>         System.out.println("serverinfo: " + getServletContext().getServerInfo());
>>     }
>>
>>  Ronald.
>>
>> Op dinsdag, 25 oktober 2011 13:33 schreef Bob DeRemer <bo...@thingworx.com>:
>>>
>>>
>>>
>>>  I may need to use some Tomcat-specific code in my web app.  As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic.   If anyone knows how best to do this, ideally with some sample java code, that'd be great.
>>>
>>>  Thanks,
>>>  Bob
>>>
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: HOW TO detect what app server you're running in

Posted by Bob DeRemer <bo...@thingworx.com>.
Good to know, thanks

-----Original Message-----
From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com] 
Sent: Wednesday, October 26, 2011 7:47 AM
To: Tomcat Users List
Subject: Re: HOW TO detect what app server you're running in

Note, that this method is unreliable.

1) The actual value can be configured by server administrator.
2) There are 3-rd party repackaged distributions of Tomcat, which may/should change the value.

It would be better to rely on presence of certain features that you are going to use, or let the user configure your webapp.

Best regards,
Konstantin Kolinko

2011/10/25 Bob DeRemer <bo...@thingworx.com>:
> Yeah, that should do it - should have remembered that - I'm already using this - purely for diagnostic info.
>
> Thanks, guys!
>
> -----Original Message-----
> From: Ronald Klop (Mailing List) [mailto:ronald-mailinglist@base.nl]
> Sent: Tuesday, October 25, 2011 7:39 AM
> To: Tomcat Users List
> Subject: Re: HOW TO detect what app server you're running in
>
> Does this help?
>
>     public void doGet(HttpServletRequest request, HttpServletResponse 
> response)
>             throws ServletException, IOException {
>         System.out.println("serverinfo: " + 
> getServletContext().getServerInfo());
>     }
>
>  Ronald.
>
> Op dinsdag, 25 oktober 2011 13:33 schreef Bob DeRemer <bo...@thingworx.com>:
>>
>>
>>
>>  I may need to use some Tomcat-specific code in my web app.  As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic.   If anyone knows how best to do this, ideally with some sample java code, that'd be great.
>>
>>  Thanks,
>>  Bob
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: HOW TO detect what app server you're running in

Posted by Konstantin Kolinko <kn...@gmail.com>.
Note, that this method is unreliable.

1) The actual value can be configured by server administrator.
2) There are 3-rd party repackaged distributions of Tomcat, which
may/should change the value.

It would be better to rely on presence of certain features that you
are going to use, or let the user configure your webapp.

Best regards,
Konstantin Kolinko

2011/10/25 Bob DeRemer <bo...@thingworx.com>:
> Yeah, that should do it - should have remembered that - I'm already using this - purely for diagnostic info.
>
> Thanks, guys!
>
> -----Original Message-----
> From: Ronald Klop (Mailing List) [mailto:ronald-mailinglist@base.nl]
> Sent: Tuesday, October 25, 2011 7:39 AM
> To: Tomcat Users List
> Subject: Re: HOW TO detect what app server you're running in
>
> Does this help?
>
>     public void doGet(HttpServletRequest request, HttpServletResponse response)
>             throws ServletException, IOException {
>         System.out.println("serverinfo: " + getServletContext().getServerInfo());
>     }
>
>  Ronald.
>
> Op dinsdag, 25 oktober 2011 13:33 schreef Bob DeRemer <bo...@thingworx.com>:
>>
>>
>>
>>  I may need to use some Tomcat-specific code in my web app.  As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic.   If anyone knows how best to do this, ideally with some sample java code, that'd be great.
>>
>>  Thanks,
>>  Bob
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: HOW TO detect what app server you're running in

Posted by Bob DeRemer <bo...@thingworx.com>.
Yeah, that should do it - should have remembered that - I'm already using this - purely for diagnostic info.

Thanks, guys!

-----Original Message-----
From: Ronald Klop (Mailing List) [mailto:ronald-mailinglist@base.nl] 
Sent: Tuesday, October 25, 2011 7:39 AM
To: Tomcat Users List
Subject: Re: HOW TO detect what app server you're running in

Does this help?

     public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException {
         System.out.println("serverinfo: " + getServletContext().getServerInfo());
     }

 Ronald.

Op dinsdag, 25 oktober 2011 13:33 schreef Bob DeRemer <bo...@thingworx.com>:
> 
>   
>  
>  I may need to use some Tomcat-specific code in my web app.  As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic.   If anyone knows how best to do this, ideally with some sample java code, that'd be great.
>  
>  Thanks,
>  Bob
>  
> 
> 
>  
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: HOW TO detect what app server you're running in

Posted by "Ronald Klop (Mailing List)" <ro...@base.nl>.
Does this help?

     public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException {
         System.out.println("serverinfo: " + getServletContext().getServerInfo());
     }

 Ronald.

Op dinsdag, 25 oktober 2011 13:33 schreef Bob DeRemer <bo...@thingworx.com>:
> 
>   
>  
>  I may need to use some Tomcat-specific code in my web app.  As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic.   If anyone knows how best to do this, ideally with some sample java code, that'd be great.
>  
>  Thanks,
>  Bob
>  
> 
> 
>  
> 

Re: HOW TO detect what app server you're running in

Posted by Edoardo Panfili <ed...@aspix.it>.
Il 25/10/11 13:33, Bob DeRemer ha scritto:
> I may need to use some Tomcat-specific code in my web app.  As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic.   If anyone knows how best to do this, ideally with some sample java code, that'd be great.
>

inside a servlet you can use
this.getServletContext().getServerInfo();

Edoardo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org