WAR (file format)

In software engineering, a WAR file (Web Application Resource or Web application ARchive ) is a file used to distribute a collection of JAR-files, Jakarta Server Pages, Jakarta Servlets, Java classes, XML files, tag libraries, static web…

Uses your system voice; voice and rate in settings.

Snapshot

≈ 2 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

In software engineering, a WAR file (Web Application Resource or Web application ARchive ) is a file used to distribute a collection of JAR-files, Jakarta Server Pages, Jakarta Servlets, Java classes, XML files, tag libraries, static web pages (HTML and related files) and other resources that together constitute a web application.

Content and structure

A WAR file may be digitally signed in the same way as a JAR file in order to allow others to determine where the source code came from. There are special files and directories within a WAR file: The /WEB-INF directory in the WAR file contains a file named web.xml which defines the structure of the web application.

If the web application is only serving JSP files, the web.xml file is not strictly necessary. If the web application uses servlets, then the servlet container uses web.xml to ascertain to which servlet a URL request will be routed.

The web.xml file is also used to define context variables which can be referenced within the servlets and it is used to define environmental dependencies which the deployer is expected to set up. An example of this is a dependency on a mail session used to send email. The servlet container is responsible for providing this service.

LINKED_PAGE=ldaps://testauth.example.com:636 The source code reads the property file to determine the target LDAP server. In this way, developers can be certain that the WAR file tested and verified is exactly the same as that which is being promoted to production.

HelloServlet mypackage.HelloServlet HelloServlet /HelloServlet Resource reference to a factory for javax.mail.Session instances that may be used for sending electronic mail messages, preconfigured to connect to the appropriate SMTP server. mail/Session javax.mail.Session Container The /WEB-INF/classes directory is on the class loader's classpath. (The classpath consists of a list of locations from which .class files can be loaded and executed by the JVM.)

The /WEB-INF/classes directory contains the classes associated with the web application itself. Any JAR files placed in the /WEB-INF/lib directory will also be placed on the class loader's classpath.

References

JSR 154: JavaTM Servlet 2.4 Specification

Text derived from https://en.wikipedia.org/w/index.php?oldid=1285316582 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

4 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.