是的。首先看看Management API reference文檔。這會給你一個管理模式的概述。
您可以使用HTTP API,CLI scripting或使用native management client來讀取屬性。以下是使用本地管理客戶端的示例。
try (final ModelControllerClient client = ModelControllerClient.Factory.create(InetAddress.getLocalHost(), 9990)) {
final ModelNode address = Operations.createAddress("subsystem", "undertow", "server", "default-server", "http-listener", "default");
final ModelNode op = Operations.createReadAttributeOperation(address, "max-post-size");
final ModelNode result = client.execute(op);
if (Operations.isSuccessfulOutcome(result)) {
System.out.println(Operations.readResult(result).asLong());
} else {
throw new RuntimeException(Operations.getFailureDescription(result).asString());
}
}
如果您使用的是maven,您只需要依賴於org.wildfly.core:wildfly-controller-client:2.2.0.Final
。 $JBOSS_HOME/bin/client
目錄中還有一個jboss-client.jar
,該目錄可放置在具有所有必需二進制文件的類路徑中。