Wicket in Action

What's new in Wicket 6

02 July 2012, by martin-g

What's new in Wicket 6

Wicket 6.0 is around the corner and it is time to describe what's new and what's has changed since Wicket 1.5. This article will mention briefly the major things. More details about the bigger changes will be provided in separate articles.

Why 6.0 ?

The Wicket team decided to use semantic versioning (http://semver.org) from now on. That means that having version like x.y.z we will fix bugs in 'z', introduce new features which do not break APIs in 'y' and break APIs in 'x' versions.
This new version has APIs breaks here and there (more on this below) so it must be a change in 'x' part of the version.
Wicket 2.0 has been used already few years ago, somewhere between Wicket 1.2 and 1.3 for a major change which didn't work well and has been discontinued. Next option was Wicket 3.0 but since Wicket 6.0 now requires JDK 6 we decided to jump to 6.0.0. That doesn't mean that Wicket 7 will require JDK 7.

Major changes in Wicket 6.0

JavaScript uses jQuery

One of the bigger changes is in the Ajax support. Since version 6.0 Wicket will use jQuery internally for its JavaScript needs. Initially we started with an implementation based on YUI but the communitity asked us to re-think this decision and use jQuery instead because most of Wicket's users use jQuery at the moment. So we switched to jQuery as backing library but made it such way that it is easy to replace the current implementation with another one based on another JavaScript library if this is needed by some of the users.

Another change in the this area is that now Wicket uses JavaScript event registration (e.g. jQuery(element).on('click', function() { ... }) instead of using inline attributes in the HTML (e.g. <a onclick="...">).

Resource management

ResourceReference class now can declare its dependencies so you just need to contribute a ResourceReference for your jQuery plugin for example, and the ResourceReference itself will tell Wicket that jQuery has to be delivered as well.

Additionally PackageResourceReference and its specializations can deliver minified version of their resource if such is available. For example by using
'new JavaScriptResourceReference(MyComponent.class, "my.js")' Wicket will deliver my.js in development mode but will deliver my.min.js in production mode if it is available in the same folder.

New Tree component

The previous Tree component implementation used AWT/SWING APIs and it was not possible to use it in more restricted environments like Google AppEngine. That's why it has been deprecated and will be removed in a some next major release of Wicket.
AbstractTree and its specializations NestedTree and TableTree are the replacements.

New modules

A few new modules have been added to the Wicket portfolio. For now they are with experimental status but depending on the adoption they will either join the other modules or will be removed.

Integration with Atmosphere

The first new module is Wicket Atmosphere (Maven id: org.apache.wicket:wicket-atmosphere:jar). It is an integration with Atmosphere project and provides server push functionality. Depending on the configuration it may use WebSocket, long polling, streaming, JSONP, Server Side events mechanisms.

Wicket Native WebSocket

The second new module is again related to server push functionality but uses native integration with the underlying web container if such is supported. At the moment only Jetty 7+ and Tomcat 7+ are supported.

What didn't make it

Component queueing

The task of component queueing was to remove the requirement to keep in sync the component trees in the markup and in Java. Due to various technical problems this task has been postponed and may be implemented in a later version of Wicket.

CDI integration

The Contexts and Dependency injection (CDI) integration implemented in wicket-cdi cannot be merged to Apache Wicket for now because it uses some libraries which are not available yet in Maven central repository. Until this problem is resolved users still can use it as described at the project site.

What else

Some more information about the major changes can be found at the Roadmap page and about other minor changes at the Migration page

The Wicket team!

-->