Chapter 6. Java Web API Servers

A man wrapped up in himself makes a very small bundle.

Benjamin Franklin

Packaging makes it possible to extend the capabilities of a language by including reusable components. The packaging available for a given language affects deployment options. Packaging schemes include consideration for standard naming conventions, metadata files, digital signatures, code obfuscation, arrangement of code, inclusion of related files/resources, and compression mechanisms.

Packaging necessarily impacts deployment. The de facto deployment options available in a language tend to suggest the structure of a project and its development workflow. In Java, this is even more pronounced than other languages. Java source file names reflect the name of the public class they contain. Java packages follow the directory structure of the file system. Java utilizes several specific package types. General purpose source code is included in Java Archives (JARs), web applications are stored in Web Application Archives (WARs), and groups of related web applications can be packaged together in Enterprise Application Archives (EARs). WARs can be deployed to servlet containers, while EARs require full Java Enterprise Edition support, which is available in application servers like JBoss.

Java’s packaging paradigm has many benefits but has resulted in a constrained view of deployment possibilities. Standard web application development practices in place since Java’s initial development required ...

Get Client-Server Web Apps with JavaScript and Java now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.