获取Java应用程序服务器名称和版本 [英] Get Java application server name and version

查看:809
本文介绍了获取Java应用程序服务器名称和版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Java编写Web应用程序,这个WAR应用程序可以部署到不同的应用程序服务器,例如Tomcat / JBoss / Jetty / Weblogic。

I am writing a Web application with Java, and this WAR application may be deployed to different application servers, such as Tomcat/JBoss/Jetty/Weblogic.

For诊断目的,我想实现一个动态网页来收集各种环境/系统信息,以便客户可以将这些信息提供给支持工程师进行诊断。

For diagnostic purpose, I'd like to implement a dynamic web page to collect various environment/system information so that customer can provide these information to support engineers for diagnostics.

有用的一条信息是应用程序服务器名称和部署此应用程序的版本,例如 Tomcat 7.0 JBoss 5.1.0 Glassfish 3.0 等。

One piece of information that is useful is the application server name and version that this application gets deployed to, such as Tomcat 7.0, JBoss 5.1.0, Glassfish 3.0, etc.

我只是想知道是否有任何标准方式从不同的JEE应用服务器检索应用服务器的名称和版本。

I just wonder if there is any standard way to retrieve application server's name and version from different JEE application servers.

推荐答案

我找到了一些代码来获取部署应用程序的服务器信息。

这段代码是用Servlet编写的,用于获取运行它的服务器信息..

I have find some code for getting server information of where you deploy your application.
This code is written in Servlet to get server info in which it is running..

String str1 = getServletContext()。getServerInfo();

通过这个,您将获得服务器名称和服务器的版本信息。

By this you will get the server name and the server's version info.

我认为它会帮助您..

I think it will some what help you..

这篇关于获取Java应用程序服务器名称和版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆