Apache Tapestry
   HOME

TheInfoList



OR:

Apache Tapestry is an
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
component-oriented
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
web application framework A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and ...
conceptually similar to
JavaServer Faces Jakarta Faces, formerly Jakarta Server Faces and JavaServer Faces (JSF) is a Java specification for building component-based user interfaces for web applications and was formalized as a standard through the Java Community Process being part of t ...
and
Apache Wicket Apache Wicket, commonly referred to as Wicket, is a component-based web application framework for the Java programming language conceptually similar to JavaServer Faces and Tapestry. It was originally written by Jonathan Locke in April 2004. Ver ...
. Tapestry was created by Howard Lewis Ship, and was adopted by the
Apache Software Foundation The Apache Software Foundation (ASF) is an American nonprofit corporation (classified as a 501(c)(3) organization in the United States) to support a number of open source software projects. The ASF was formed from a group of developers of the A ...
as a top-level project in 2006. Tapestry emphasizes simplicity, ease of use, and developer productivity. It adheres to the
Convention over Configuration Convention over configuration (also known as coding by convention) is a software design paradigm used by software frameworks that attempts to decrease the number of decisions that a developer using the framework is required to make without necessa ...
paradigm, eliminating almost all XML configuration. Tapestry uses a modular approach to web development by having a strong binding between each
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
component (object) on the web page and its corresponding
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
class. This component-based architecture borrows many ideas from
WebObjects WebObjects was a Java web application server and a server-based web application framework originally developed by NeXT Software, Inc. WebObject's hallmark features are its object-orientation, database connectivity, and prototyping tools. Ap ...
.


Notable features

; Live Class Reloading: Tapestry monitors the file system for changes to Java page classes, component classes, service implementation classes, HTML templates and component property files, and it hot-swaps the changes into the running application without requiring a restart. This provides a very short code-save-view feedback cycle that is claimed to greatly improve developer productivity. ; Component-based : Pages may be constructed with small nestable components, each having a template and a component class. Custom components are purportedly trivial to construct. ; Convention over configuration: Tapestry uses naming conventions and annotations, rather than XML, to configure the application.Drobiazko 2012, p. 7. ; Spare use of HTTPSession : By making minimal use of the HTTPSession, Tapestry is designed to be highly efficient in a clustered, session-replicated environment. ; Post/Redirect/Get: Most form submissions follow the Post/Redirect/Get (PRG) pattern, which reduces multiple form submission accidents and makes URLs friendlier and more bookmarkable, along with enabling the browser Back and Refresh buttons to operate normally. ; Inversion of Control (IoC): Tapestry is built on a lightweight
Inversion of Control In software engineering, inversion of control (IoC) is a design pattern in which custom-written portions of a computer program receive the flow of control from a generic framework. A software architecture with this design inverts control as compa ...
layer with similarities to
Google Guice Google Guice (pronounced like "juice") is an open-source software framework for the Java platform released by Google under the Apache License. It provides support for dependency injection using annotations to configure Java objects. Dependenc ...
, but designed to make nearly all aspects of Tapestry's behavior configurable and replaceable.


Hello World Example

A minimal, templated Tapestry application needs only three files: ; HelloWorld.tml : The (X)HTML template for the /helloworld page. Tapestry templates can contain any well-formed (X)HTML markup.

Hello, $

; HelloWorld.java : The page class associated with the template. Here, it merely provides a *username* property that the template can access. package org.example.demo.pages; /** A page class (automatically associated with the template file of the same name) */ public class HelloWorld ; web.xml : The
servlet A Jakarta Servlet (formerly Java Servlet) is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web application ...
application
Deployment Descriptor A deployment descriptor (DD) refers to a configuration file for an artifact that is deployed to some container/engine. In the Java Platform, Enterprise Edition, a deployment descriptor describes how a component, module or application (such as a w ...
, which installs Tapestry as a servlet filter. Tapestry Example tapestry.app-package org.example.demo app org.apache.tapestry5.TapestryFilter app /*


Class transformation

Tapestry uses bytecode manipulation to transform page and component classes at runtime. This approach allows the page and component classes to be written as simple POJOs, with a few naming conventions and annotations potentially triggering substantial additional behavior at class load time. Tapestry versions 5.0, 5.1 and 5.2 used the
Javassist Javassist (Java programming assistant) is a Java library providing a means to manipulate the Java bytecode of an application. In this sense Javassist provides the support for structural reflection, i.e. the ability to change the implementation of ...
bytecode manipulation library. Subsequent versions replaced Javassist with a new bytecode manipulation layer called ''Plastic'' that is based on
ObjectWeb ASM The ASM library is a project of the OW2 consortium. It provides a simple API for decomposing, modifying, and recomposing binary Java classes (i.e. bytecode). The project was originally conceived and developed by Eric Bruneton. ASM is Java-centric a ...
.


Client-side support

Tapestry 5 versions up through 5.3 bundled the
Prototype A prototype is an early sample, model, or release of a product built to test a concept or process. It is a term used in a variety of contexts, including semantics, design, electronics, and Software prototyping, software programming. A prototyp ...
and script.aculo.us JavaScript frameworks, along with a Tapestry-specific library, so as to support Ajax operations as first-class citizens. Third party modules are available to integrate jQuery instead of, or in addition to, Prototype/Scriptaculous. Starting with version 5.4, Tapestry includes a new JavaScript layer that removes built-in components' reliance on Prototype, allowing jQuery or another JavaScript framework to be plugged in. Version 5.4 also introduces support for JavaScript ''modules'' using the RequireJS module loading system.


Core principles

The Tapestry project documentation cites four "principles" that govern all development decisions for Tapestry, starting with version 5 in 2008: * Static Structure, Dynamic Behavior—page and component structure is essentially static, eliminating the need to construct (and store in session memory) large page and component trees. * Adaptive API—the framework is designed to adapt to the code, rather than having the code adapt to the framework * Differentiate Public vs. Internal APIs—all APIs are explicitly "internal" (private) except those that are necessarily public. * Ensure Backwards Compatibility—The Tapestry developers are reportedly committed to ensuring that upgrading to the latest version of Tapestry is always easy.


Criticism

Tapestry has been criticized as not being backward-compatible across major versions, especially noted in the transition from version 4 to version 5, where no clean migration path was available for existing applications. Project team members have acknowledged this as a major problem for Tapestry's users in the past, and backward compatibility was made a major design goal for Tapestry going forward. From early on in the development of version 5, backward compatibility was listed as one of Tapestry's four new "Core Principles", and two of the other three were intended to make the evolution of the framework possible without sacrificing backward compatibility. Project team members claim that all Tapestry releases since 5.0 have been highly backward compatible. Early criticisms of Tapestry 5 also mentioned documentation as a shortcoming. Project members now claim that this deficiency has been largely addressed with a thoroughly revised and updated User's Guide and other documentation. Since version 5.0, Tapestry has bundled the Prototype and Scriptaculous JavaScript libraries. According to Howard Lewis Ship, in the 2008-2009 timeframe these were reasonable choices. Since then, however, Prototype's popularity has declined, and jQuery's has risen dramatically. In response, the Tapestry community developed modules that allowed jQuery to be used in addition to, or instead of, Prototype. Meanwhile, the current version of Tapestry, 5.4, removes the dependency on Prototype entirely, replacing it with a compatibility layer into which either jQuery or Prototype (or potentially any other JavaScript framework) can be plugged.


Relation to other frameworks

According to Howard Lewis Ship, Tapestry was initially conceived as an attempt to implement in Java some of the general concepts and approaches found in WebObjects, which was at that time written in
Objective-C Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTS ...
and closed-source.
Apache Wicket Apache Wicket, commonly referred to as Wicket, is a component-based web application framework for the Java programming language conceptually similar to JavaServer Faces and Tapestry. It was originally written by Jonathan Locke in April 2004. Ver ...
was developed as a response to the complexity of early versions of Tapestry, according to Wicket originator Jonathan Locke.
Facelets In computing, Facelets is an open-source Web template system under the Apache license and the default view handler technology (aka view declaration language) for Jakarta Server Faces (JSF; formerly JavaServer Faces). The language requires val ...
, the default view technology in
JavaServer Faces Jakarta Faces, formerly Jakarta Server Faces and JavaServer Faces (JSF) is a Java specification for building component-based user interfaces for web applications and was formalized as a standard through the Java Community Process being part of t ...
, was reportedly inspired by early versions of Tapestry, as an attempt to fill the need for "a framework like Tapestry, backed by JavaServer Faces as the industry standard".


History


See also

*
Apache Wicket Apache Wicket, commonly referred to as Wicket, is a component-based web application framework for the Java programming language conceptually similar to JavaServer Faces and Tapestry. It was originally written by Jonathan Locke in April 2004. Ver ...
* Comparison of web frameworks *
Facelets In computing, Facelets is an open-source Web template system under the Apache license and the default view handler technology (aka view declaration language) for Jakarta Server Faces (JSF; formerly JavaServer Faces). The language requires val ...
*
Java EE Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web serv ...
*
Java view technologies and frameworks Java view technologies and frameworks are web-based software libraries that provide the user interface, or " view-layer", of Java web applications. Such application frameworks are used for defining web pages and handling the HTTP requests (click ...


References

* * * *


Notes


External links

* {{Authority control
Tapestry Tapestry is a form of textile art, traditionally woven by hand on a loom. Tapestry is weft-faced weaving, in which all the warp threads are hidden in the completed work, unlike most woven textiles, where both the warp and the weft threads may ...
Java enterprise platform Web frameworks