WAR (file format)

Web ARchive
Filename extension
.war
Internet media typeapplication/java-archive
Magic numberPK\x03\x04 (standard ZIP file)
Developed bySun Microsystems
Container forJSP, Java Servlet
Extended fromJAR

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 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 testing environment may be something like ldaps://testauth.example.com:636. The LDAP server in a production environment is ldaps://auth.example.com:636. An external properties file would define the link with some thing like:

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.

Disadvantages of WAR files

Some[who?] 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]

Example

The following sample web.xml file demonstrates the declaration and association of a servlet:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
    <servlet>
        <servlet-name>HelloServlet</servlet-name>
        <servlet-class>mypackage.HelloServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>HelloServlet</servlet-name>
        <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>

    <resource-ref>
        <description>
            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.
        </description>
        <res-ref-name>mail/Session</res-ref-name>
        <res-type>javax.mail.Session</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
</web-app>

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.

See also

References

  1. ^ Crossley, Allistair. "Apache Tomcat 8 (8.0.44) - Tomcat Web Application Deployment". Apache Software Foundation. Retrieved 2017-06-27.
  2. ^ Hunter, Jason (1999-10-15). "What's New in Java Servlet API 2.2?". JavaWorld. Retrieved 2020-11-08.
  3. ^ "Web Application Lifecycle". The Java EE 6 Tutorial. Oracle.
  4. ^ "Deploying on a running Tomcat server". Apache Software Foundation.

Read other articles:

Lambang Lviv. Motto: Semper Fidelis (Bahasa Latin:Selalu Setia) L'viv (Львів dalam bahasa Ukraina; Львов, Lvov dalam bahasa Rusia; Lwów dalam bahasa Polandia; Leopolis dalam bahasa Latin; Lemberg dalam bahasa Jerman atau Lemberk dalam bahasa Yiddish) adalah sebuah kota yang sekarang terletak di sebelah barat Ukraina. Kota ini memiliki penduduk sekitar 730.000 jiwa (dengan tambahan 200.000 jiwa yang hidup di sekitar kota ini. Kota ini merupakan ibu kota daerah L'viv dan sebuah pusat...

 

Peta infrastruktur dan tata guna lahan di Komune Chavelot.  = Kawasan perkotaan  = Lahan subur  = Padang rumput  = Lahan pertanaman campuran  = Hutan  = Vegetasi perdu  = Lahan basah  = Anak sungaiChavelot merupakan sebuah komune di departemen Vosges yang terletak pada sebelah timur laut Prancis. Lihat pula Komune di departemen Vosges Referensi INSEE lbsKomune di departemen Vosges Les Ableuvenettes Ahéville Aingeville Ainvelle Allarmont Ambacourt Ameuv...

 

Latvian professional road cyclist Aleksejs SaramotinsSaramotins at the 2014 UCI Road World ChampionshipsPersonal informationFull nameAleksejs SaramotinsBorn (1982-04-08) 8 April 1982 (age 42)Riga, Latvian SSR (now Latvia)Height184 cm (6 ft 0 in)Weight75 kg (165 lb)Team informationDisciplineRoadRoleRiderRider typeClassics specialist[1]Professional teams2005–2008Rietumu Banka–Riga2009Team Designa Køkken2010Team HTC–Columbia2011–2012Cofidi...

Miracles in DecemberSampul album untuk versi Korea (kiri) dan versi Tionghoa (kanan)Album mini karya EXODirilis9 Desember 2013 (2013-12-09)Direkam2013Genre Lagu natal R&B pop Bahasa Korea Mandarin Label S.M. Entertainment Produser Lee Soo-man (exec.) Kronologi EXO XOXO(2013)XOXO2013 Miracles in December(2013) Overdose(2014)Overdose2014 Singel dalam album Miracles in December Miracles in DecemberDirilis: 5 Desember 2013 (2013-12-05) Miracles in December (Korea: 12월의 기�...

 

Revolution group formed in 1966 The (Central) Cultural Revolution Group (CRG or CCRG; Chinese: 中央文革小组; pinyin: Zhōngyāng Wéngé Xiǎozǔ) was formed in May 1966 as a replacement organisation to the Central Committee Secretariat and the Five Man Group, and was initially directly responsible to the Standing Committee of the Politburo. It consisted mainly of radical supporters of Mao, including Chen Boda, the Chairman's wife Jiang Qing, Kang Sheng, Yao Wenyuan, Zhang Chunq...

 

密西西比州 哥伦布城市綽號:Possum Town哥伦布位于密西西比州的位置坐标:33°30′06″N 88°24′54″W / 33.501666666667°N 88.415°W / 33.501666666667; -88.415国家 美國州密西西比州县朗兹县始建于1821年政府 • 市长罗伯特·史密斯 (民主党)面积 • 总计22.3 平方英里(57.8 平方公里) • 陸地21.4 平方英里(55.5 平方公里) • ...

Artikel ini membutuhkan rujukan tambahan agar kualitasnya dapat dipastikan. Mohon bantu kami mengembangkan artikel ini dengan cara menambahkan rujukan ke sumber tepercaya. Pernyataan tak bersumber bisa saja dipertentangkan dan dihapus.Cari sumber: Jalan Tol Semarang–Demak – berita · surat kabar · buku · cendekiawan · JSTOR Jalan Tol Semarang-DemakSemarakInformasi ruteDikelola oleh PT PP Semarang DemakPanjang:24.74 km (15,37 mi)Berdiri:25 Februari 202...

 

Niementowski quinazoline synthesis Named after Stefan Niementowski Reaction type Ring forming reaction The Niementowski quinazoline synthesis is the chemical reaction of anthranilic acids with amides to form 4-oxo-3,4-dihydroquinazolines (3H-quinazolin-4-ones).[1][2][3] The Niementowski quinazoline synthesis Uses Research has demonstrated that the Niementowski quinazoline synthesis could be employed for the creation of potential EGFR-inhibiting molecules. Hensbergen et al.[4] have shown a sy...

 

Former evangelical Christian movement For the music album, see Danny Gokey discography. For the community, see Jesus People USA. For the film, see Jesus People: The Movie. For the first century movement which focused on Jesus of Nazareth, see Early Christianity. Jesus movement in Amsterdam The Jesus movement was an evangelical Christian movement that began on the West Coast of the United States in the late 1960s and early 1970s and primarily spread throughout North America, Europe, Central Am...

Class of board game This article is about the board game genre. For other uses, see Table game. Tables familyA tables board from DamascusYears activec. 3rd millennium BC to presentPlayers2 (or more in some variants)Setup time< 1 minutePlaying time5–30 minutesChanceDiceSkillsStrategy, probability Tables games are a class of board game that includes backgammon and which are played on a tables board, typically with two rows of 12 vertical markings called points. Players roll dice to d...

 

British motoring TV show (2002–2022) Top GearGenreAutomotive entertainmentComedySportCreated byJeremy ClarksonAndy WilmanWritten byRichard PorterPaul KerensaDirected byBrian KleinPhil ChurchwardMark McQueenPresented by Jeremy Clarkson Jason Dawe Richard Hammond James May The Stig Chris Evans Matt LeBlanc Sabine Schmitz Eddie Jordan Chris Harris Rory Reid Freddie Flintoff Paddy McGuinness Opening themeJessica by The Allman Brothers BandComposerDickey Betts (arr. by Christian Henson)Country o...

 

  Concorso a squadre maschileAmsterdam 1928 Informazioni generaliLuogoStadio Olimpico di Amsterdam Periodo8 - 10 agosto Partecipanti88 da 11 nazioni Podio  Svizzera Argento  Cecoslovacchia Bronzo  Jugoslavia Edizione precedente e successiva Parigi 1924 Los Angeles 1932 Voce principale: Ginnastica ai Giochi della IX Olimpiade. Ginnastica a Amsterdam 1928 Concorso individuale uomini Concorso a squadre   uomini   donne Volteggio uomini Cavallo con maniglie uomin...

Come leggere il tassoboxGramigna rossaCynodon dactylonStato di conservazioneSpecie non valutata Classificazione APG IVDominioEukaryota RegnoPlantae (clade)Angiosperme (clade)Mesangiosperme (clade)Monocotiledoni (clade)Commelinidi OrdinePoales FamigliaPoaceae SottofamigliaChloridoideae TribùCynodonteae SottotribùEleusininae GenereCynodon SpecieC. dactylon Classificazione CronquistDominioEukaryota RegnoPlantae DivisioneMagnoliophyta ClasseLiliopsida OrdineCyperales FamigliaPoaceae GenereCynod...

 

Ruler of Mantua Not to be confused with Francesco I Gonzaga, Marquess of Mantua from 1407 to 1444. Portrait of Francesco I Gonzaga Francesco I Gonzaga (1366 – 7 March 1407) was ruler of Mantua from 1382 to 1407. He was also a condottiero. Succeeding his father Ludovico II Gonzaga in 1382, he led a policy of balance between the nearby powers of the Visconti of Milan and Venice. In 1380, he married Agnese, daughter of Barnabò Visconti.[1] When she was executed in 1391 under accus...

 

مستوطنة قرية الأثرية مستوطنة قرية الأثرية المنطقة منطقة تبوك  السعودية تعديل مصدري - تعديل   قُريِّة هي مستوطنة اثرية في السعودية، تقع إلى الشمال الغربي من مدينة تبوك وعلى بعد 90 كم منها. وهي عبارة عن مدينة سكنية ومنطقة زراعية تعود إلى الألف الأول قبل الميلاد، وقد اكتش�...

Rafle de Saint-Mandé Type Rafle (Shoah en France) Pays France Localisation Saint-Mandé Organisateur  Reich allemand Date 22 juillet 1944 Répression Arrestations 242 enfants - 33 adultes modifier  La rafle de Saint-Mandé prend place le samedi 22 juillet 1944 au no 5 de la rue Grandville à Saint-Mandé (Val-de-Marne)[1], dans un centre de l'UGIF, pour enfants. Ces derniers sont déportés par le Convoi no 77, en date du 31 juillet 1944, le dernier grand convoi au dépa...

 

Pour les articles homonymes, voir Cage (homonymie). Cet article est une ébauche concernant la zoologie. Vous pouvez partager vos connaissances en l’améliorant (comment ?) selon les recommandations des projets correspondants. Cages à oiseaux anciennes Une cage est un contenant ajouré, le plus souvent grillagé ou à barreaux, destiné généralement à contenir un animal. Une cage empêche son occupant de s'enfuir ou permet de l'observer sans risque, elle protège également son co...

 

American painter Joseph Henry BushSelf-portrait, 1837Born1794/1800Mercer County, Kentucky, U.S.DiedJanuary 11, 1865Lexington, Kentucky, U.S.Resting placeLexington CemeteryOccupationPainter Portrait of Zachary Taylor by Joseph Henry Bush. Joseph Henry Bush (1794/1800 – January 11, 1865) was an American portrait painter. Born in Kentucky, he was trained by Thomas Sully in Philadelphia, and he opened his first studio in Frankfort, followed by Lexington and Louisville.[1] He also lived ...

Р

Chữ Kirin ErHệ chữ KirinMẫu tự SlavАБВГҐДЂЃЕЀЁЄЖЗЗ́ЅИЍІЇЙЈКЛЉМНЊОПРСС́ТЋЌУЎҮФХЦЧЏШЩЪЫЬЭЮЯMẫu tự ngôn ngữ phi SlavӐА̄А̊А̃ӒӒ̄ӘӘ́Ә̃ӚӔҒГ̧Г̑Г̄ҔӺӶԀԂꚂꚀꚈԪԬӖЕ̄Е̃Ё̄Є̈ӁҖꚄӜԄҘӞԐԐ̈ӠԆӢИ̃ҊӤҚӃҠҞҜԞԚӅԮԒԠԈԔӍӉҢԨӇҤԢԊО̆О̃О̄ӦӨӨ̄ӪҨԤҦР̌ҎԖҪԌꚐҬꚊꚌԎУ̃ӮӰӰ́ӲҮҮ́ҰХ̑ҲӼӾҺҺ̈ԦꚔҴꚎҶӴӋҸꚒꚖꚆҼҾЫ̆Ы̄ӸҌЭ̆Э̄Э̇�...

 

この記事は検証可能な参考文献や出典が全く示されていないか、不十分です。 出典を追加して記事の信頼性向上にご協力ください。(このテンプレートの使い方)出典検索?: アサヒペン – ニュース · 書籍 · スカラー · CiNii · J-STAGE · NDL · dlib.jp · ジャパンサーチ · TWL (2013年12月) 株式会社アサヒペンASAHIPEN CORPORATION 大阪本社種...