Taxonomy of Java Web Application Frameworks
Taxonomy of Java Web Application Frameworks
Tony C Shan Wachovia Bank [email protected] Winnie W Hua CTS Inc. [email protected]
Abstract
This paper describes various web application frameworks and related emerging technologies pertinent to the Java EE model from a technical perspective. A definition of web application framework is specified, as this terminology has been widely used and implies drastically different meanings in different contexts. The value proposition of a web application framework is presented to illustrate how a framework can improve the application development productivity and quality. The design philosophy of web application frameworks is articulated. A comprehensive taxonomic scheme is defined to classify various software frameworks and web application frameworks into appropriate categories. Among dozens of web application frameworks available as commercial and open source solutions, the predominant products are investigated, followed by the selection guidelines and recommendations. A reference card is constructed to summarize the key aspects of web application frameworks. Relevant technologies and future trends are also discussed.
1. Introduction
In information systems environment, a framework is a defined support structure in which other software applications can be organized and developed. A framework may include support programs, code libraries, a scripting language, common services, interfaces, or other software packages/utilities to help develop and glue together the different components of a software application. A software framework is a reusable design and building blocks for a software system and/or subsystem. A software framework can be geared toward constructing applications in different domains, such as financial modeling applications [1] or decision support systems [2]. A software framework consists of frozen spots and hot spots [3]. The frozen spots define the overall
architecture of a software system its basic components and the relationships between them. These remain unchanged (frozen) in any instantiation of the application framework. On the other hand, hot spots represent those parts of the software framework that are specific to individual software systems. Hot spots are designed to be generic. In other words, they can be adapted to the needs of the application under development. Software frameworks define the places in the architecture where adaptations for specific functionality should be made - the hot spots. In an object-oriented environment, a framework consists of abstract and concrete classes. Instantiation of such a framework consists of composing and subclassing the existing classes [4]. When developing a concrete software system with a software framework, the hot spots are specialized according to the specific needs and requirements of the system. Software frameworks rely on the Hollywood Principle: "Dont call us, well call you." [5]. This means that the user-defined classes such as new subclasses receive messages from the predefined framework classes. These are usually handled by implementing superclass abstract methods, in a way similar to the use of the Template design pattern.
2. Software frameworks
In general, there are seven types of software frameworks in the information systems space: Conceptual Framework overarching architectural model such as the Zachman Framework; Application Framework skeletal structure for an application solution such as WebWork; Domain Framework tailored to specific business sectors such as IBM Information Framework (IFW); Platform Framework programming model and runtime environment such as .Net and Java EE framework;
Component Framework building blocks for an application such as Hibernate, iBatis and Cayenne for object-relational mapping; Service Framework business and technical services model for service-oriented computing such as Semantic Web Services Framework; Development Framework a construction foundation to build a rich-client development tool, typically for IDEs, such as Eclipse, Netbeans, and OSGi.
development infrastructure for web applications is the best way to ensure that development is not locked into any proprietary, dead-end architecture. This approach dramatically reduces technology churn and risk since the industry-standard open source frameworks are actively maintained and enhanced by the highly skilled professionals in the world. These developers take the responsibility of identifying the appropriate technologies, integrating the software, testing these technologies, and providing migration paths for existing users to the latest technology. A Web Application Framework is typically deployed in an n-tier architecture and uses proven, standard technology. By using standard technologies, a framework can be easily deployed within existing enterprise infrastructures, leveraging existing hardware, software, processes, and people. 2.3.2. Relevant domain services Virtually all web applications have a common set of basic requirements, such as user management (e.g., secure user login, password recovery), group management, and access authorization. A Web Application Framework usually includes all these functionalities, refined through hundreds of production deployments, freeing developers to focus on the needs of their specific application. In addition to a basic set of services, web applications typically have two other important similarities: they store important data in a relational database and they interact with users via a web-based user interface. A sophisticated object-relational persistence layer automatically manages how model objects are stored in the database. The persistence layer, by generating optimized SQL from metadata, drastically reduces the amount of effort required to model and refactor database schemas or support additional database architectures. A Web Application Framework may also include a component-based presentation rendering framework, that enables developers to extend existing UI components or build new components that can be reused throughout an application, e.g. XSL and tag libraries. A breadth of domain services such as data validation, versioning, categorization, print, page navigation and full-text search may be provided. Any application written on top of a Web Application Framework can transparently and immediately take advantage of these basic services.
Simplicity less and simpler code should be written to use a framework. Avoid overuse of XML configuration files. Take advantage of the POJO-centric design. Consistency - components, containers and conventions should be consistent Efficiency - applications should perform well and scale with support of clustering through sticky sessions preferred. Integration a framework should not compete with good existing solutions, but should foster seamless integration. Reusability constructs in a framework should be fully reusable and are easy to distribute/deploy. Non-intrusive HTML or other markup should not be polluted with programming semantics, with compatibility with ordinary HMTL editors and easy manipulation fro graphics designer to recognize and avoid framework tagging. Diagnosis - when things go wrong, the framework should not get in the way; in fact, it should provide useful diagnostics and debugging information. Development tools maximum tool support with minimum dependency on special tools.
Almost all Java Web application frameworks are based on the MVC pattern. Generally speaking, there are currently five major schools of web application frameworks: Request-based, Component-based, Hybrid, Meta, and RIA-based Framework. A Request-based Framework is very close to the original CGI specification. It uses controllers and actions that directly handle incoming requests. Each request is essentially stateless. With the introduction of server-side sessions, a certain degree of statefulness has been achieved. Various frameworks basically differentiate themselves by the way they map the logic to URLs and how data is structured and provided to the business handlers. A Component-based Framework abstracts the internals of the request handling and encapsulates the logic into reusable components, often independent from the web medium. The state is automatically handled by the framework, based on the data that is present in each component instance. Together with some form of event handling, this development model is very similar to the features offered by desktop GUI toolkits. Various frameworks basically differentiate themselves by the provided component API and how components are integrated together. A Hybrid Framework combines both request-based and component-based frameworks by taking control of the entire data and logic flow in a request-based model.
Developers remain close to the architecture of CGI applications and have full control over URLs, forms, parameters, cookies and pathinfos. However, instead of mapping actions and controllers directly to the request, a hybrid framework provides a component object model that behaves identically in many different situations such as individual pages, intercepted requests, portal-like page fragments and integratable widgets. Components can be wired together and be packaged as groups that are components in their own right. They can be distributed separately and be seamlessly integrated into other projects. This combines the form of reusability in component-based frameworks with the raw control of a request-based approach. A Meta Framework has a set of core interfaces for common services and a highly extensible backbone for integrating components and services. The structure typically implements the Inversion of Control pattern for separation of concerns to flexibly incorporate other frameworks and components. A Meta Framework is sometimes considered as a framework of frameworks. Rich Internet Application (RIA) refers to a web page-based application running in a browser with rich user interface features that are common in fat client, such as drag and drop, tree controls, and tabbed panels. A RIA-based Framework uses a client-side container model, which minimizes the amount of server communication instead of loading an entire HTML page each time the user clicks, the framework either handle the click locally (without involving the server) or request data from the server in an XML format. This means that there truly is a client-side application with state and a user interaction model the client is far more than a web page generated on a server.
classic Model-View-Controller (MVC) design pattern. Under Model 2, a Servlet (or equivalent) manages business logic execution, and presentation logic resides mainly in server pages. Struts was originally developed by Craig McClanahan and donated to the Apache Foundation in May 2000. Struts has been a de facto framework with a strong and vibrant user community. The Apache Struts project is now comprised of two distinct frameworks. The two frameworks are the Struts Action Framework and the Struts Shale Framework. In addition, The Simple Web Framework (SWF) is an event-based framework targeting Struts developers who want to build rich Web applications but do not want to migrate to JSF. Beehive Beehive [8] (Apache 2006) is an extensible Java application framework with an integrated metadatadriven programming model for web services, web applications, and resource access. The framework leverages the latest innovations in the Java 5, particularly JSR 175 metadata annotations. The key components are NetUI Page Flow, Controls, and Web Service Metadata. Beehive evolved from a part of BEA Weblogic Workshop product to an Apache project in May 2004. Stripes Stripes [9] is a robust yet lightweight presentation framework with zero external configuration per page/action, binding engine that builds complex object webs out of the request parameters, built-in support for multiple events per form, transparent file upload capabilities, and wizard forms. Stripes was initially released in September 2005. 3.3.2. Component-based framework JSF JavaServer Faces (JSF) [10, 11] is a server-side user interface component framework for Java-based Web applications. JSF contains an API for representing UI components and managing their state; handling events, server-side validation, and data conversion; defining page navigation; supporting internationalization and accessibility; and providing extensibility for all these features. It also contains two JSP (JavaServer Pages) custom tag libraries for expressing UI components within a JSP page and for wiring components to server-side objects. The specification of JSF 1.0 (JSR-127) was initially released in March 2004. JSF 1.2 Specification (JSR252) is the next generation of JSF, which has a final draft released in August 2005.
Tapestry Tapestry [12] complements and builds upon the standard Java Servlet API, and divides a web application into a set of pages, each constructed from components. This provides a consistent structure, allowing the Tapestry framework to assume responsibility for key concerns such as URL construction and dispatch, persistent state storage on the client or on the server, user input validation, localization/internationalization, and exception reporting. Developing Tapestry applications involves creating HTML templates using plain HTML, and combining the templates with small amounts of Java code using (optional) XML descriptor files. In Tapestry, an application is created in terms of objects, and the methods and properties of those objects -- and specifically not in terms of URLs and query parameters. Tapestry brings true object-oriented development to Java web applications. Tapestry was originally created by Howard Lewis Ship, and the project was moved to the Apache Foundation around early 2004. Wicket Wicket [13] is a framework that takes simplicity, separation of concerns and ease of development to a new level. Wicket pages can be mocked up, previewed and later revised using standard WYSIWYG HTML design tools. Dynamic content processing and form handling is all handled in Java code using a component model backed by POJO data beans that can easily be persisted using different technology. Wicket has a transparent state management with no XML configuration files. The first release of Wicket 1.0 went public in June 2005. 3.3.3. Hybrid framework RIFE RIFE [14] is a full-stack web application framework with tools and APIs to implement most common web features. Each of its toolkits is usable by itself and together they offer powerful integrated features that boost your productivity. RIFE ensures that every declaration and definition is handled in one place in the code. This simplifies the developer's task by reducing code replication, enforcing consistency, and easing maintenance. RIFE 1.0 was released in September 2005. 3.3.4. Meta framework Keel Keel [15] is ready made server side infrastructure. Keel incorporates multiple open source projects to provide a best of breed framework that works right out
of the box. What differentiates Keel is its component design, allowing new implementations to be added and old implementations replaced without requiring extensive rewrites of the application code. The first pre-release of Keel was out in January 2003, though the initial group was formed in February 2002 and Keel was named in March of the same year. Spring Spring [16] is a layered Java EE application framework, which includes a lightweight container for automated configuration and wiring of application objects via inversion of control (aka dependency injection), an abstraction layer for transaction management, a JDBC abstraction layer, AOP functionality, and integration with O-R mappers. The origins of Spring can be traced back to a book by Rod Johnson [17], who presented his interface 21 framework that was later released into the open source world, this framework formed the foundation of the Spring framework. The first official 1.0 release was available in March 2004. 3.3.5. RIA-based framework DWR Direct Web Remoting [18] is a framework of calling Java code on the server directly from JavaScript in the browser. DWR consists of two main parts: JavaScript running in the user's browser to communicate with the server and dynamically update the webpage, and a Java Servlet running on the server that processes requests and sends responses back to the browser. DWR takes a novel approach to Ajax by dynamically generating JavaScript code-based Java classes. Consequently the web developer can use Java code from JavaScript as if it were local to the webbrowser; whereas in reality the Java code runs in the web-server and has full access to web-server resources The first release of DWR went public in 2005. Echo2 Echo2 [19] is the next-generation of the Echo Web Framework, a platform for developing web-based applications that approach the capabilities of rich clients. The 2.0 version holds true to the core concepts of Echo while providing dramatic performance, capability, and user-experience enhancements made possible by its new Ajax-based rendering engine. Echo2 removes the developer from having to think in terms of "page-based" applications and enables him or her to develop applications using the conventional object-oriented and event-driven paradigm for user interface development. Knowledge of HTML, HTTP, and JavaScript is not required. Applications may be hosted using any Java Servlet container. Echo2, like its
predecessor, is open-source software distributed under the terms of the Mozilla Public License or the GNU LGPL License, if preferred. Echo2 initial alpha release became available in March 2005. JSON-RPC-Java JSON-RPC-Java [20] is a dynamic JSON-RPC implementation in Java. It allows you to transparently call server-side Java code from JavaScript with an included lightweight JSON-RPC JavaScript client. It is designed to run in a Servlet container such as Tomcat and can be used with JBoss and other J2EE Application servers to allow calling of plain Java or EJB methods from within a JavaScript DHTML web application. Minimal or zero changes are necessary to existing server-side Java code to allow calling from JavaScript (such as the marshalling and unmarshalling of special types) as JSON-RPC-Java dynamically maps JavaScript objects to and from Java objects using Java reflection. JSON-RPC-Java allows simple exporting of Java objects by reflection on their method signatures (a single line of code is required to provide access to all public methods of a Java object). The first major release 1.0 was made available in March 2006.
Selection of one of these frameworks is dependent on the overall architectural decisions as well as the specific functionality of the application. Frameworks are not always required but can significantly reduce the time and effort needed to develop an application from scratch. Other architectural considerations may drive the use of specific frameworks or the migration from an old framework to a mainstream one in the design process. Struts is supported in IBM WebSphere Application Server and WebSphere Studio Application Developer (WSAD) IDE as well as the Rational Application Developer, which replaces the WSAD. Similarly, JSF is supported in IBM WebSphere Application Server and WebSphere Studio Application Developer IDE as well as the new Rational Application Developer. Sun Microsystems provides a JSF Reference Implementation, which it is free to redistribute in binary form. In addition, Apache MyFaces project offers an open source JSF implementation of JSR-127. MyEclipse Enterprise Workbench (Version 4.0) supports Sun JSF Reference Implementation 1.1.01, and MyFaces 1.0.9. It also provides Tapestry integration.
Use of Beehive requires JDK 1.5. The Beehive product supports JSR-175 metadata annotations. Beehives NetUI Page Flow is based on Struts. Pollinate is an Eclipse technology project slated to build an Eclipse-based IDE and toolset that leverages the open source Apache Beehive application framework. The mainstay of the Struts framework is the controller components, which can be used with any Java presentation technology. JSF and JavaServer Standard Tag Library (JSTL) are complementary to Struts, and extensions are available. Spring provides an AOP framework, a unique transaction management abstraction, and a unique data access abstraction. Spring Modules is an associated project, which extends the reach of the Spring platform to areas that are not necessarily integral to the Spring core. Spring IDE is a graphical user interface for the configuration files used by the Spring Framework. It is built as a set of plugins for the Eclipse platform. As a general implementation guideline in web application designs, Spring may be considered first as a preferred baseline, and subsequently an appropriate front controller implementation is justified Struts, JSF, Wicket, and RIFE. Flexible rendering mechanisms should be evaluated. Beehive can be used in combination with Struts. The Page Flow in Beehive is more mature than the WebFlow in Spring. Stripes is a good candidate if an application needs wizard forms. Tapestry may be used in niche areas at discretion. DWR and Echo2 are viable options to develop RIA systems. A reference card is constructed to summarize the key aspects in web application frameworks, as illustrated in Table 1.
4. Other frameworks
4.1. Java
The following table lists the major Java web application frameworks that are not addressed in the foregoing sections.
Cocoon Maverick Bishop Verge jZonic OpenEmcee Baritus JWAA Dovetail Millstone JPublish Niggle wingS TeaServlet Bento Nacho Smile Japple OXF JATO Barracuda Expresso JBanana Genie Turbine Jaffa Cameleon SOFIA Folium Shocks Melati Chiba JWarp Dovetail Warfare Cassandra Canyamo Jucas Jeenius Xoplon Jacquard Macaw Scope JFormular Helma
6. Future Trends
The need for a web application framework is compelling as there have been dozens of frameworks built in the Java space over the years. Among these competing offerings, a few products have stood out to become the predominant contenders for various reasons such as strong user community, standardization, good documentation, tool integration, vendor endorsement, and easy to use. Some examples are Struts/Shale, JSF/MyFaces, Spring, Tapestry, Beehive, and DWR.
Product
Struts
Key Features