WAR (Sun file format)

WAR (Sun file format)

Infobox file format
name = Web ARchive
extension = .war
mime =
owner = Sun Microsystems
creatorcode =
genre =
containerfor = JSP, Java Servlet
containedby =
extendedfrom =
extendedto =
In computing, a WAR file (which stands for "web application archive" [http://java.sun.com/developer/technicalArticles/Servlets/servletapi/] ) is a JAR file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages (HTML and related files) 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 assert that the code is trusted.

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 is to be routed. web.xml 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.

One disadvantage of web deployment using WAR files in very dynamic environments is that minor changes cannot be made during runtime. Any change whatsoever requires regenerating and redeploying the entire WAR file. Most JEE web containers allow web applications to be deployed as a directory instead of a single file. This is known as an exploded archive. An exploded archive may be used during development to quickly test changes to a web application.

The following sample "web.xml" file demonstrates how a servlet is declared and associated. 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 ClassLoader's classpath. This is where .class files are loaded from when the web application is executing.Any JAR files placed in the /WEB-INF/lib directory will also be placed on the ClassLoader's classpath.

See also

Related file formats:
* EAR (file format)
* JAR (file format)

External links

* [http://www.jsptube.com Servlet tutorial]
* [http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/WCC3.html SDN J2EE 1.3 Tutorial: Web Application Archives]
* [http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd Sun Microsystems: XML Schema for the Servlet 2.5 Web ARchive (WAR) File]
* [http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd Sun Microsystems: XML Schema for the Servlet 2.4 Web ARchive (WAR) File]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • EAR (file format) — An Enterprise ARchive, or EAR, is a file format used by Java EE for packaging one or more modules into a single archive so that the deployment of the various modules onto an application server happens simultaneously and coherently. It also… …   Wikipedia

  • WAR (file format) (disambiguation) — In computing, a WAR file (short for Web ARchive) may refer to: * Sun WAR (file format), a JAR file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages (HTML and related files) …   Wikipedia

  • War (disambiguation) — War is a large scale conflict.War may also refer to:In Places: * War, West Virginia * West Antarctic Rift * Warwickshire county in EnglandIn Music: * War (band), a 1970s funk band * War (Swedish band), a Swedish black metal band * War (album), a… …   Wikipedia

  • KDE WAR (file format) — Infobox file format name = Web ARchive extension = .war mime = application/x webarchive owner = The KDE Team creatorcode = genre = containerfor = Web pages containedby = extendedfrom = extendedto = In computing, a WAR file (short for Web ARchive) …   Wikipedia

  • JAR (file format) — Infobox file format name = Java Archive icon = extension = .jar mime = application/java archive type code = uniform type = com.sun.java archive owner = Sun Microsystems genre = file archive, data compression container for = contained by =… …   Wikipedia

  • ZIP (file format) — unzip redirects here. For the program, see Info ZIP. ZIP Filename extension .zip .zipx (newer compression algorithms) Internet media type application/zip Uniform Type Identifier com.pkware.zip archive Magic …   Wikipedia

  • tar (file format) — tar GNU tar 1.23 showing three common types of Tarballs (shown in red). Filename extension .tar Internet media type application/x tar …   Wikipedia

  • WAR (format de fichier) — WAR (Web Application ARchive) Java Web Application Archive Extension .war Type MIME application/java archive Développé par Sun Microsystems Type de format Archive (avec Compression de données) Extension du …   Wikipédia en Français

  • Sun SPARC — Logo der Sparc Architektur SUN SPARC …   Deutsch Wikipedia

  • Intel-Format — Die Byte Reihenfolge (engl.: Byte Order oder Endianness) bezeichnet die Speicherorganisation für einfache Zahlenwerte, in erster Linie die Ablage von ganzzahligen Werten (Integer) im Arbeitsspeicher. Eine Festlegung des zu verwendenden… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”