7.8.2. 读取部署内容

您可以使用 read-content 操作读取受管部署中文件的内容。不提供任何参数来返回整个部署,或使用 path 参数提供特定文件的路径。例如:

/deployment=helloworld.war:read-content(path=META-INF/MANIFEST.MF)

这会返回一个文件流,它可显示在管理 CLI 中或保存到文件系统中

{
    "outcome" => "success",
    "result" => {"uuid" => "24ba8e06-21bd-4505-b4d4-bdfb16451b95"},
    "response-headers" => {"attached-streams" => [{
        "uuid" => "24ba8e06-21bd-4505-b4d4-bdfb16451b95",
        "mime-type" => "text/plain"
    }]}
}

7.8.2.1. 显示文件的内容

使用 附加 display 命令读取 MANIFEST.MF 文件的内容。

attachment display --operation=/deployment=helloworld.war:read-content(path=META-INF/MANIFEST.MF)

这会将 MANIFEST.MF 文件的内容从 helloworld.war 部署 显示到管理 CLI。

ATTACHMENT 8af87836-2abd-423a-8e44-e731cc57bd80:
Manifest-Version: 1.0
Implementation-Title: Quickstart: helloworld
Implementation-Version: 7.3.0.GA
Java-Version: 1.8.0_131
Built-By: username
Scm-Connection: scm:git:git@github.com:jboss/jboss-parent-pom.git/quic
 kstart-parent/helloworld
Specification-Vendor: JBoss by Red Hat
...