【问题标题】:Is it possible to check if a tomcat server is running in port 8080 using Jquery?是否可以使用 Jquery 检查 Tomcat 服务器是否在端口 8080 中运行?
【发布时间】:2011-12-16 13:49:53
【问题描述】:

我必须在jsp页面显示tomcat和mysql的运行状态..如果tomcat和mysql都down了,我必须显示为“down”..当我使用java时

try {
URL url = new URL(protocol, host, port, "");
URLConnection connection = url.openConnection();

connection.connect();
} catch (Exception e) {
    isAlive = false;
}

加载带有状态的 jsp 花费了太多时间。所以我打算用 jquery 检查 tomcat 状态。这可能吗?或者我可以通过什么方式完成它。

【问题讨论】:

  • Tomcat宕机了怎么运行jsp页面?
  • @jrummell 也许他有两台服务器,一台充当代理,另一台实际工作......

标签: jquery mysql tomcat port


【解决方案1】:

通过 jquery 中的 ajax 调用该服务器上的某个站点:

  $.get("some_site_url")
    .success(function() { alert("server is working"); })
    .error(function() { alert("server is not working"); }); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-14
    • 1970-01-01
    • 2020-01-02
    • 1970-01-01
    • 1970-01-01
    • 2022-11-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多