7.5. 使用 HTTP API 部署应用程序

可以通过 curl 命令使用 HTTP API 将应用部署到 JBoss EAP。有关使用 HTTP API 的更多信息,请参阅 HTTP API 部分。

7.5.1. 使用 HTTP API 将应用程序部署到单机服务器

默认情况下,HTTP API 可通过 http://HOST: PORT/management 访问,例如 http://localhost:9990/management

部署应用程序
$ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "test-application.war"}, "content" : [{"url" : "file:/path/to/test-application.war"}]},{"operation" : "deploy", "address" : {"deployment" : "test-application.war"}}],"json.pretty":1}'
取消部署应用
$ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "undeploy", "address" : {"deployment" : "test-application.war"}},{"operation" : "remove", "address" : {"deployment" : "test-application.war"}}],"json.pretty":1}'

请参阅本红帽知识库文章,以编程方式生成 JSON 请求。