如何获取Websphere 6.1端口号 [英] How to get Websphere 6.1 port number

查看:167
本文介绍了如何获取Websphere 6.1端口号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究WebSphere 6.1 Web项目.

I'm currently working on a WebSphere 6.1 Web Project.

在我的Java代码中,如何获取当前正在运行的应用程序端口?

In my java code, how can i get the current running application port?

推荐答案

Servlet API为您提供HttpServletRequest中的本地端口.

The servlet API gives you the local port in HttpServletRequest.

protected void doGet(HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    PrintWriter writer = response.getWriter();
    writer.write("" + request.getLocalPort());
    writer.close();
}

端口是在节点的 serverindex.xml 中定义的(例如[WAS]/profiles/AppSrv01/config/cells/localhostNode01Cell/nodes/localhostNode01/serverindex.xml).

The ports are defined in the node's serverindex.xml (e.g. [WAS]/profiles/AppSrv01/config/cells/localhostNode01Cell/nodes/localhostNode01/serverindex.xml).

<specialEndpoints xmi:id="NamedEndPoint_1214751102556" endPointName="WC_defaulthost">
  <endPoint xmi:id="EndPoint_1214751102556" host="*" port="9080"/>

我不确定WAS JMX支持是否公开此信息-您必须检查文档.

I'm not sure if the WAS JMX support exposes this information - you'd have to check the doc.

这篇关于如何获取Websphere 6.1端口号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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