Web archive

The web archive (WAR) is the most common package used in enterprise applications. It is used to install the web applications using technologies such as Servlet, JSF, or more client-oriented ones like the most recent frameworks AngularJS or Vaadin. To deploy a WAR, it is mandatory to add the web.xml descriptor file in the WEB-INF folder.

In the web archive, we can also install REST services and WebSocket. The web.xml is never useful in these cases, but it's a good rule to release it for customization.

As shown in Chapter 14, Writing a JSF Application, we need a faces-config.xml descriptor file in the WEB-INF folder to install JSF applications.

Other useful deployment descriptors to put in the WEB-INF folder are as follows:

  • *.taglig.xml: Descriptor file containing custom tags and functions. It can be named by any name. The only rule is that the filename ends with the .taglib.xml extension.
  • beans.xml: It is mandatory to use CDI inside a web/REST application.

Details on the packaging can be seen in Chapters 6, Creating REST Services, Chapter 7, Implementing WebSockets, Chapter 10, Asynchronous REST, and Chapter 13, Working with Servlets and JSP, where the web is deeply shown.

Another special folder is the lib inside the WEB-INF folder. All the external dependencies used by the application must be in this folder. A good rule is not replicate the dependencies just installed in WildFly. WildFly provides a wide set of libraries that can be used in the applications.

The last specifications provide all the other components too, to put in a WAR. The extension of the package is not important since several years because the annotations have simplified much of the configuration of the components. So, if a class is annotated as an EJB, this component will automatically be installed as an EJB and the application server will not care about the extension name of the descriptor file present inside the package. In this chapter, to maintain a right complete order, we will continue to show the extension files and the descriptor files inside the packages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.143.181