看看Alfresco Server是否可用

编程入门 行业动态 更新时间:2024-10-09 10:22:04
本文介绍了看看Alfresco Server是否可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在与Alfresco合作,有时服务器因低空间或其他问题而关闭,事情是我的serverURL我想检查他是否可用(Alfresco服务器)我想做ping但是adresse是简单ping for的复杂内容: http:// 127.0.0.1:8084/alfresco/api/-default-/public/cmis/versions/1.0/atom 我在J2EE项目中工作

I am working with Alfresco and sometimes the server is down for low space or other problem , the thing is with my serverURL i want to check if he is available (Alfresco Server) i thought to make a ping but the adresse is to complexe for a simple ping ex : 127.0.0.1:8084/alfresco/api/-default-/public/cmis/versions/1.0/atom I am working in a J2EE Project

推荐答案

您好我想说的是@Gagravarr给出的部分答案

Hi i want to say that the part of the answer where given by @Gagravarr

public void pingADR() throws UnknownHostException, IOException { String url = "127.0.0.1:8084/alfresco/service/api/server"; String status = getStatus(url); System.out.println(url + "\t\tStatus:" + status); }

并查看是否可用

public static String getStatus(String url) throws IOException { String result = ""; try { URL siteURL = new URL(url); HttpURLConnection connection = (HttpURLConnection) siteURL .openConnection(); connection.setRequestMethod("GET"); connection.connect(); int code = connection.getResponseCode(); if (code == 200) { result = "Green"; } } catch (Exception e) { result = "->Red<-"; } return result; }

我在一个非常有用的网站上找到了这个答案,希望能帮助其他人人

I found this answer in a very helpful web site, Hope that will help other people

更多推荐

看看Alfresco Server是否可用

本文发布于:2023-11-28 18:07:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643424.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Alfresco   Server

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!