Tomcat: War - co to jest?
Ogólnie rzecz biorąc to war to taki zip, tylko Tomcatowy. Są w nim spakowane - najczęściej skompilowane - pliki Tomcata takie jak .java, .xml, .jar, servlety itp. To się rozpakowuje podczas startowania Tomcata i dzięki temu Tomcat tworzy sobie folder, na którym pracuje.
Pełny opis jest na wikipedii:
Pełny opis jest na wikipedii:
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.Contents
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.
Advantages of WAR files
- Easy testing and deployment of web applications
- Easy identification of the version of the deployed application
- All Java EE containers support WAR files
- MVC structure supports 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:636The 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 files
Some 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]
Komentarze
Prześlij komentarz