World Library  
Flag as Inappropriate
Email this Article

Apache Tapestry

Article Id: WHEBN0002052309
Reproduction Date:

Title: Apache Tapestry  
Author: World Heritage Encyclopedia
Language: English
Subject: Java view technologies and frameworks, PRADO (framework), Comparison of web application frameworks, Apache Shale, Apache Software Foundation
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Apache Tapestry

Apache Tapestry
Original author(s) Howard Lewis Ship
Developer(s) Apache Software Foundation
Stable release 5.3.8 / November 20, 2014 (2014-11-20)
Development status Active
Written in Java
Operating system Cross-platform (Java Virtual Machine)
Type Web Framework
License Apache License 2.0
Website citation

Apache Tapestry is an open-source component-oriented Java web application framework conceptually similar to JavaServer Faces and Apache Wicket.[22] Tapestry was created by Howard Lewis Ship, and was adopted by the Apache Software Foundation as a top-level project in 2006.[23]

Tapestry emphasizes simplicity, ease of use, and developer productivity. It adheres to the Convention over Configuration paradigm, eliminating almost all XML configuration.[24] Tapestry uses a modular approach to web development, by having a strong binding between each user interface component (object) on the web page and its corresponding Java class. This component-based architecture borrows many ideas from WebObjects.[25]

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.[26]
Component-based
Pages may be constructed with small nestable components, each having a template and component class. Custom components are purportedly trivial to construct.[27]
Convention over configuration
Tapestry uses naming conventions and annotations, rather than XML, to configure the application.[28]
Spare use of HTTPSession
By making minimal use of the HTTPSession, Tapestry is designed to be highly efficient in a clustered, session-replicated environment.[29]
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.[30]
Inversion of Control (IOC)
Tapestry is built on a lightweight Inversion of Control layer with similarities to Google Guice but designed to make nearly all aspects of Tapestry's behavior configurable and replaceable.[31]

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, ${username}

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 {

    /** an ordinary getter */
    public String getUsername() {
        return "world";
    }
}
web.xml
The servlet application Deployment Descriptor, 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 bytecode manipulation library. Subsequent versions replaced Javassist with a new bytecode manipulation layer called Plastic which is based on ObjectWeb ASM.[32][33]

Client-side Support

Tapestry 5 versions up through 5.3 bundle the Prototype 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.[34]

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:[35]

  • 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.[36] 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 next version of Tapestry, 5.4, is expected to remove 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 and

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.