词条 | WAR (file format) |
释义 |
| name = Web ARchive | extension = .war | mime = | owner = Sun Microsystems | creatorcode = | genre = | containerfor = JSP, Java Servlet | containedby = | extendedfrom = JAR | extendedto = }} In software engineering, a WAR file (Web Application Resource[1] or Web application ARchive[2]) is a file used to distribute a collection of JAR-files, JavaServer Pages, Java 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 structureA 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:
Advantages of WAR files
Assuming production environments do not promote a fix without sufficient testing prior to deployment, a WAR file has a distinct advantage when properties files are used to identify environment specific variables. For example, an LDAP server in a TEST environment may be something like ldaps://testauth.company.com:636. The LDAP server in a production environment is ldaps://auth.company.com:636. An external properties file would define the link with some thing like: LINKED_PAGE=ldaps://testauth.company.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. Disadvantages of WAR filesSome consider web deployment using WAR files to be disadvantageous when minor changes to source code are required for dynamic environments. Each change to source code must be repackaged and deployed in development. [3] This does not require stopping the web server if configured for runtime deployment. [4] ExampleThe following sample web.xml file demonstrates the declaration and association of a servlet: The /WEB-INF/classes directory is on the ClassLoader'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 ClassLoader's classpath. See alsoRelated file formats:
References1. ^{{Cite web|url=https://tomcat.apache.org/tomcat-8.0-doc/deployer-howto.html|title=Apache Tomcat 8 (8.0.44) - Tomcat Web Application Deployment|last=Crossley|first=Allistair|website=tomcat.apache.org|language=en|access-date=2017-06-27}} 2. ^{{cite web|url=http://www.oracle.com/technetwork/articles/javase/servletapi-137835.html |title=What's New in Java Servlet API 2.2? |publisher=JavaWorld (Reprinted by Oracle Corporation)|date=October 1999 |accessdate=2014-08-26}} 3. ^{{cite web|title=Web Application Lifecycle|url=https://docs.oracle.com/cd/E19316-01/819-3669/bnadu/index.html|publisher=Oracle}} 4. ^{{cite web|title=Deploying on a running Tomcat server|url=http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html#Deploying_on_a_running_Tomcat_server|publisher=Apache}} External links
2 : Archive formats|Java enterprise platform |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。