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 what source the 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. 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. Advantages of WAR files:
- easy development, testing and deployment
- the version of the deployed application is easily identified
- all J2EE containers support .WAR files
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.
The following sample web.xml file demonstrates how a servlet is declared and associated.
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.
Read more about this topic: WAR File Format (Sun)
Famous quotes containing the words content and/or structure:
“They tell us that women can bring better things to pass by indirect influence. Try to persuade any man that he will have more weight, more influence, if he gives up his vote, allies himself with no party and relies on influence to achieve his ends! By all means let us use to the utmost whatever influence we have, but in all justice do not ask us to be content with this.”
—Mrs. William C. Gannett, U.S. suffragist. As quoted in History of Woman Suffrage, vol. 5, ch. 8, by Ida Husted Harper (1922)
“It is difficult even to choose the adjective
For this blank cold, this sadness without cause.
The great structure has become a minor house.
No turban walks across the lessened floors.
The greenhouse never so badly needed paint.”
—Wallace Stevens (18791955)