Check if Wildfly Server works with my application?

I would like to know how I can check if my Wildfly Server is up and running WebApp?

I am currently checking only if the server is running.

public static boolean checkServerAvailable() {
    try {

        String url = Constants.URL_APP + ":" + Constants.APPSERVER_PORT;

        HttpURLConnection.setFollowRedirects(false);
        // note : you may also need
        // HttpURLConnection.setInstanceFollowRedirects(false)
        HttpURLConnection con = (HttpURLConnection) new URL(url)
                .openConnection();
        con.setRequestMethod("HEAD");

        if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {
            return true;
        }

        else
            return false;

    } catch (Exception e) {
        return false;
    }
}

But I need to know if the Wildfly server also disabled my web application.

+4
source share
2 answers

, URL- webapp URL-, . , , http://localhost:8080/ HTTP 200, http://localhost:8080/yourApp . , - .

, "heartbeat" "status" -. - http://localhost:8080/yourApp/status. 200, , . , . , , , . , , URL- .

+3

API , WildFly. API WildFly.

WildFly9 - . https://wildscribe.imtqy.com/Wildfly/9.0.0.Final/deployment/index.html

URL-, . .

:

http://localhost:9990/management/deployment/<deployment_name>

:

http://localhost:9990/management/host/<host_name>/server/<serer_name>/deployment/<deployment_name>

JSON ( , EAR ):

{
"content": [{
    "hash": {
        "BYTES_VALUE": "2gH7ddtUxsbzBJEJ/z4T1jYERRU="
    }
}],
"enabled": true,
"enabled-time": 1468861076770,
"enabled-timestamp": "2016-07-18 18:57:56,770 CEST",
"name": "myapplication.ear",
"owner": null,
"persistent": true,
"runtime-name": "myapplication.app.ear",
"subdeployment": {
    "myapplication.impl.jar": null,
    "myapplication.web.war": null
},
"subsystem": null

}

curl:

curl --digest -D - http://localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"read-resource", "include-runtime":"true", "address":["deployment","myapplication.app.ear"] }' -u user:password
+2

Source: https://habr.com/ru/post/1651575/


All Articles