This is the consolidated list of changes between Tapestry versions 5.2 and 5.3. To upgrade from 5.2 to 5.3, most users who are not using deprecated features will be able to just update the Maven dependency in their POM file (or download the new JAR file) and the new version will just work. However, please read carefully below before upgrading, and also review the How to Upgrade instructions.
Tapestry now depends on Servlet API version 2.5 (prior releases worked with 2.4).
Tapestry no longer supports the ability to inject the component id into a String field. This was rarely (if ever) used functionality that caused unwanted conflicts elsewhere. When a component needs to know its component id, it may inject the ComponentResources object, and invoke
Tapestry templates without a <!DOCTYPE> are treated a bit differently in Tapestry 5.3; they are treated as if they have the HTML5 doctype (
<!DOCTYPE html>). See further notes about component templates.
Many classes and interfaces that were deprecated in prior releases of Tapestry have been removed in Tapestry 5.3. See the full list. As always, you should use your IDE to find and replace all deprecated items before you upgrade. The following are the most significant of these:
- @ApplicationState annotation (replaced with @SessionState)
- "validateForm" event triggered by Form component (replaced with "validate" event)
- Code and constants related to page pooling
In addition, some of the abstract base classes used with the tapestry-func library have changed into interfaces; you will want to recompile, but may also need to adjust your code, depending on your compiler settings and use of the standard Java @Override annotation.
value.toJSON() may break; replace with
Some number of interfaces and APIs in Tapestry 5.3 will be removed in Tapestry 5.4 or later. These include:
- The MultiZoneUpdate object, replaced with AjaxResponseRenderer
- ClassFactory service and ClassFab interface (replaced with the PlasticProxyFactory service and PlasticClass interface)
- The "suppress redirects" functionality, which allows component event requests to respond directly with HTML, as in Tapestry 4.
Tapestry now bundles Underscore.js, a useful library for expressive functional programming in the browser. It is used in no conflict mode, made available as the
Tapestry now has a central mechanism for handling user alerts; this includes the AlertManager service and the Alerts component. Just add an Alerts component to your application's standard layout component and Tapestry takes care of the rest. Alerts can be added during both traditional and Ajax requests, and may be transient (displayed for a few seconds), normal, or sticky (persist until the user expressly dismisses them). Alerts support three severities: info, warn(ing) and error; the look and feel can be customized by overriding Tapestry's default CSS rules.
It is now possible to have Tapestry emit rendering comments; these are comments (such as
<!--BEGIN Index:loop (context:Index.tml, line 15)-->) that can assist you in debugging markup output on the client-side. This is enabled for all requests using the configuration symbol
tapestry.component-render-tracing-enabled, and can be added to any request by adding the query parameter
t:component-trace=true to the URL. This will significantly increase the size of the rendered markup, but can be very helpful with complex layouts to determine which component was responsible for which portion of the rendered page.
Adaptable service contributions
When making contributions to a service, you are no longer restricted to contributing a value that is assignable to the type associated with the configuration; objects of any type may be contributed, and the TypeCoercer service is used to coerce the value to the configuration's type.
Component debugging improvements
Because of how Tapestry instruments your pages and components, using a debugger has been difficult with Tapestry page and component classes; any mutable field shows its default value in the debugger, regardless of what has been written to the field or read out of it. In Tapestry 5.3, when in development mode, Tapestry now shadows values read from or written to such fields into the fields themselves (this has also been fixed in the 5.2.5 maintenance release). This shadowing does not occur in production, to avoid potential memory leaks.
Reloading disabled in production
Tapestry no longer checks for changes to Tapestry component class files, templates, or message catalogs in production mode. It is assumed that Tapestry applications are packaged as WAR files in production, and that changing the WAR file causes the servlet container to redeploy the entire application. This change is to improve throughput and reduce memory consumption in production applications.
The TypeCoercer service now automatically generates String-to-Enum coercions without requiring a specific contribution. This coercion is case insensitive. A contribution is still allowed, and will take priority over the default coercion, but is only necessary to support "aliases" for enum values outside those defined by the enum type itself.
The type of this service has changed from ComponentClassTransformWorker to ComponentClassTransformWorker2. Contributions of type ComponentClassTransformWorker will automatically be coerced to the new ComponentClassTransformWorker2 interface. However, if you use the @Contribute annotation to mark the method that makes contributions, you will need to update the annotation to indicate the new service interface. If you followed the naming convention, and named your method
contributeComponentClassTransformWorker(), you don't need to change anything.
The AjaxResponseRenderer service makes it easier to customize the partial page response generated when updating a Zone component, replacing the MultiZoneUpdate object as an event handler method return value.
Tapestry now includes a new library, tapestry-javadoc, that replaces the old Maven-based component report. Simply by placing a
@tapestrydoc annotation into your component's JavaDoc, Tapestry will generate complete documentation as part of JavaDoc ... no more switching back and forth between JavaDoc and the Maven-generated component report, and no more reliance on Maven for component documentation.
Skinning / Theming Support
Tapestry now adds the ability to skin and/or theme your pages and components. Its an extension of how Tapestry manages pages per locale, but adds new application-defined axes along with rules to find the resources. See ComponentResourceSelector and ComponentRequestSelectorAnalyzer.
There's also a new Dynamic component, which uses an external template, not a Tapestry template, which can be selected at runtime.
Tapestry finally has a proper Tree component for navigating hierarchical data. It's efficient and Ajax-enabled, and fully customizable.
Form Cancelled Event
Form components now recognize when the client-side form was cancelled. A new "cancelled" event is triggered early in the submission process, which allows the page to bypass all property updates and input validations, when desired.
Implicit OrderedConfiguration Constraints
When using OrderedConfiguration.add() with no constraints, Tapestry will now implicitly order the added element after the previously added element, within the same method. In prior releases, such elements were added with no constraints. This makes it easier to contribute a group of related items with an implicit ordering.
New Component Class Validations
Tapestry includes new validations of component classes to help cut down on many common errors; Tapestry now checks that component ids referenced by an event handler method (the
Fromcomponent id part of the method name) actually matches a component defined in the template ... this quickly identifies typos in method names. This check can be disabled with a configuration symbol, as existing 5.2 apps may have such errors and still operate (that is, they may have dead event handler methods that will never be invoked).
Tapestry can now be configured to execute inside a folder, which can be useful when running Tapestry inside a web application that contains other servlets or filters, as a way to prevent conflicts.
Improved Quickstart Archetype
The Maven quickstart archetype has been brought up to date, and now demonstrates several new bits of common useful functionality. It also generates support for Gradle as the build tool.
The new @WhitelistAccessOnly annotation marks a page as accessible only from white-listed clients; the rules for the whitelist are extensible. The default rule is that only access from localhost is on the white-list. Use this annotation on pages that may expose sensitive data, such as built-in application dashboards and the like.
Tapestry applications now include a built-in "PageCatalog" page, which lists all the loaded pages of the application, with details about construction time and number of components. The page requires whitelist access (see above comment), and some functionality is only available in development mode. PageCatalog can be used to load all pages of your application, which is useful to quickly spot problems in your pages ... especially useful when upgrading from a prior release of Tapestry.
In addition, Tapestry will now display a pop-up window containing the full exception report for a server-side error that occurs during an Ajax request, which makes debugging server-side problems that occur as part of an Ajax request significantly easier. Note that this logic is tied to performing a Zone update.
New Features Implemented