Since WildFly 11 you can use the management API to read / download content from a managed deployment.
This can easily be achieved with the JBoss CLI or the Web Console.
Using the JBoss CLI
Let's create a simple managed deployment :
/deployment=test.war:add(content=[{input-stream-index=/home/ehsavoie/webapplication/target/test.war}])
Now we can use the read-content operation:
/deployment=test.war:read-content(path=META-INF/MANIFEST.MF) { "outcome" => "success", "result" => {"uuid" => "d97fb694-ab10-4736-963e-a21bd45af76e"}, "response-headers" => {"attached-streams" => [{ "uuid" => "d97fb694-ab10-4736-963e-a21bd45af76e", "mime-type" => "text/plain" }]} }
As you can see the returned value is an attached stream, so we will need to use the new "attachment" operation of the cli that will allow you to display or save the content of that attached stream.
This "attachment" operation will take a save or display action parameter and the operation designed to read the content.
Let's see how to use this operation :
attachment display --operation=/deployment=test.war:read-content(path=META-INF/MANIFEST.MF) ATTACHMENT d0c7e210-1a90-4046-800e-53e71dfe977d: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.7 Created-By: 1.8.0_111-b14 (Oracle Corporation) Dependencies: org.wildfly.broken
Or to save the content of this file :
attachment save --operation=/deployment=test.war:read-content(path=META-INF/MANIFEST.MF) File saved to /home/ehsavoie/dev/wildfly/wildfly/dist/target/wildfly-11.0.0.Alpha1-SNAPSHOT/bin/0224e5f5-a57c-4735-8762-47db324f31d9
Using the Web Console
Navigate to 'Deployments' and select the deployment you want to browse. Then open the context menu and choose 'Browse Content':
This opens a new page with the contents of the deployment. For each file, there's a link with the full path and size of the file. Click on the link to download the file:
Comments