How to Deploy War File in Wildfly 10

Now you can read content from a deployment, so you can directly see what's in your deployment. This operation can be use to browse the content of a deployment and read or download its files (even from inside an archive file).

Using the JBoss CLI

Using the browse-content operation you can have the list of files in the deployment :

            [standalone@localhost:9990 /] /deployment=to_be_exploded.war:browse-content {     "outcome" => "success",     "result" => [         {             "path" => "META-INF/",             "directory" => true         },         {             "path" => "META-INF/MANIFEST.MF",             "directory" => false,             "file-size" => 134L         },         {             "path" => "WEB-INF/",             "directory" => true         },         {             "path" => "WEB-INF/classes/",             "directory" => true         },         {             "path" => "WEB-INF/classes/org/",             "directory" => true         },         {             "path" => "WEB-INF/classes/org/wildfly/",             "directory" => true         },         {             "path" => "WEB-INF/classes/org/wildfly/sample/",             "directory" => true         },         {             "path" => "WEB-INF/classes/org/wildfly/sample/simplewebapp/",             "directory" => true         },         {             "path" => "WEB-INF/web.xml",             "directory" => false,             "file-size" => 916L         },         {             "path" => "WEB-INF/classes/org/wildfly/sample/simplewebapp/SimpleServlet.class",             "directory" => false,             "file-size" => 2302L         },         {             "path" => "index.html",             "directory" => false,             "file-size" => 234L         },         {             "path" => "META-INF/maven/",             "directory" => true         },         {             "path" => "META-INF/maven/org.wildfly.sample/",             "directory" => true         },         {             "path" => "META-INF/maven/org.wildfly.sample/SimpleWebapp/",             "directory" => true         },         {             "path" => "META-INF/maven/org.wildfly.sample/SimpleWebapp/pom.xml",             "directory" => false,             "file-size" => 2992L         },         {             "path" => "META-INF/maven/org.wildfly.sample/SimpleWebapp/pom.properties",             "directory" => false,             "file-size" => 125L         }     ] }          

You can reduce the output by filtering using the path, depth and archive parameters. For exemple

            [standalone@localhost:9990 /] /deployment=to_be_exploded.war:browse-content(path=WEB-INF/, depth=1) {     "outcome" => "success",     "result" => [         {             "path" => "web.xml",             "directory" => false,             "file-size" => 916L         },         {             "path" => "classes/",             "directory" => true         }     ] }          

So now we can display the content of the web.xml. Using the read-content operation is not sufficient enough as it will return an attachment:

            [standalone@localhost:9990 /] /deployment=to_be_exploded.war:read-content(path=WEB-INF/web.xml) {     "outcome" => "success",     "result" => {"uuid" => "c778c51e-a507-4a71-a21f-d6af8b230db4"},     "response-headers" => {"attached-streams" => [{         "uuid" => "c778c51e-a507-4a71-a21f-d6af8b230db4",         "mime-type" => "application/xml"     }]} }          

So we need to combine this operation with the attachment operation like this :

            [standalone@localhost:9990 /] attachment display --operation=/deployment=to_be_exploded.war:read-content(path=WEB-INF/web.xml) ATTACHMENT 582a10e0-5159-4d2b-8d07-8d39af0df8c3: <?xml version="1.0" encoding="UTF-8"?>  <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"     version="3.1">     <session-config>         <session-timeout>             30         </session-timeout>     </session-config>     <servlet id="SimpleServlet">         <servlet-name>SimpleServlet</servlet-name>         <display-name>SimpleServlet</display-name>         <servlet-class>org.wildfly.sample.simplewebapp.SimpleServlet</servlet-class>         <init-param>             <param-name>message</param-name>             <param-value>Hello World</param-value>         </init-param>     </servlet>     <servlet-mapping>         <servlet-name>SimpleServlet</servlet-name>         <url-pattern>/SimpleServlet</url-pattern>     </servlet-mapping> </web-app>          

And to save this content locally we can use:

            [standalone@localhost:9990 /] attachment save --operation=/deployment=to_be_exploded.war:read-content(path=WEB-INF/web.xml) --file=/home/ehsavoie/tmp/web.xml File saved to /home/ehsavoie/tmp/web.xml          

Using the web console

Navigate to 'Deployments' and select the deployment you want to browse. Then open the context menu and choose Browse Content:

browse content op

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:

content

Using HAL.NEXT

The next major version of the web console (HAL.next) is currently under active development and is available as technical preview https://github.com/hal/hal.next. Follow the instruction in https://github.com/hal/hal.next#running to get started. Besides general improvements like better navigation and a revisited look and feel, HAL.next comes with many improvements for dealing with deployments:

  • Add Deployments using drag & drop.

  • New content browser using a tree view and an editor with syntax highlighting.

  • Download complete deployments or single files of a deployment.

Select deployments and just click on View to display its content:

explode next

This opens a new page which allows for a really nice way to browse and read content from a deployment:

content next

How to Deploy War File in Wildfly 10

Source: https://www.wildfly.org/news/2017/09/08/Exploded-deployments/

0 Response to "How to Deploy War File in Wildfly 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel