6.8. 查看部署内容
您可以浏览 受管部署中文件的信息,并使用 JBoss EAP 管理界面 读取文件的内容。
6.8.1. 浏览部署中的文件 复制链接链接已复制到粘贴板!
使用 browse-content 操作来查看受管部署中的文件和目录。不提供任何参数来返回整个部署结构,或使用 path 参数来提供到特定目录的路径。
您也可以从管理控制台浏览部署内容,导航到 Deployments 选项卡,选择部署,然后从下拉菜单中选择 View。
/deployment=helloworld.war:browse-content(path=META-INF/)
这将显示 helloworld.war 部署的 META-INF/ 目录中的文件和目录。
{
"outcome" => "success",
"result" => [
{
"path" => "MANIFEST.MF",
"directory" => false,
"file-size" => 827L
},
{
"path" => "maven/org.jboss.eap.quickstarts/helloworld/pom.properties",
"directory" => false,
"file-size" => 106L
},
{
"path" => "maven/org.jboss.eap.quickstarts/helloworld/pom.xml",
"directory" => false,
"file-size" => 2713L
},
{
"path" => "maven/org.jboss.eap.quickstarts/helloworld/",
"directory" => true
},
{
"path" => "maven/org.jboss.eap.quickstarts/",
"directory" => true
},
{
"path" => "maven/",
"directory" => true
},
{
"path" => "INDEX.LIST",
"directory" => false,
"file-size" => 251L
}
]
}
您还可以在 browse-content 操作中指定以下参数。
- archive
- 是否仅返回存档文件。
- depth
- 指定要返回的文件的深度。
6.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"
}]}
}
6.8.2.1. 显示文件的内容 复制链接链接已复制到粘贴板!
使用 attachment display 命令来读取 MANIFEST.MF 文件的内容。
attachment display --operation=/deployment=helloworld.war:read-content(path=META-INF/MANIFEST.MF)
这将显示从 helloworld.war 部署到管理 CLI 的 MANIFEST.MF 文件的内容。
ATTACHMENT 8af87836-2abd-423a-8e44-e731cc57bd80:
Manifest-Version: 1.0
Implementation-Title: Quickstart: helloworld
Implementation-Version: 7.4.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
...
6.8.2.2. 保存文件的内容 复制链接链接已复制到粘贴板!
使用 attachment save 命令将 MANIFEST.MF 文件的内容保存到文件系统。
attachment save --operation=/deployment=helloworld.war:read-content(path=META-INF/MANIFEST.MF) --file=/path/to/MANIFEST.MF
这会将 helloworld.war 部署中的 MANIFEST.MF 文件保存到 路径/到 /MANIFEST.MF 的文件系统。如果不使用 the-file 参数指定文件路径,该文件将使用其唯一附加 ID 命名,并保存在管理 CLI 的工作目录中,默认为 EAP_HOME/bin/。