You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Migrating to Wicket 6.0

Environment

  • Wicket 6.0 requires at least Java 6

Repeaters

  • `IDataProvider` was converted to using `long` instead of `int` to better line up with JPA and other persistence frameworks. This has caused a rather large cascade of `int` to `long` changes all over the repeater packages (WICKET-1175).

Form Processing

Validation

  • `DateValidator` no longer has static factory methods, use `new DateValidator(min,max)` instead
  • `StringValidator` no longer has static factory methods, use `new StringValidator(min, max)` instead
  • `StringValidator` will add the `maxlen` attribute if added to a component attached to an input tag
  • `AbstractValidator` has been removed
  • `ValidationError` now makes creating standard error keys (classname and classname.subtype) easier
  • Most validators provide a `decorate(ValidationError, Validatable)` method for overriding how they report errors

Ajax

Use JQuery as a backing library for Wicket Ajax functionality

Apache Wicket needed to improve the implementation of its JavaScript libraries used for Ajax functionality (wicket-ajax.js and wicket-event.js) by using any of the bigger JavaScript libraries and delegate to it the handling of the differences in the browsers (DOM, events, Ajax, ...). After a discussion in the mailing lists the Wicket team decided to use JQuery for that.
For more information read Wicket Ajax

IHeaderResponse, including decorators and filters

IHeaderResponse has been rewritten to render HeaderItems. All render* methods have been replaced by a single render(HeaderItem) method. HeaderItems can be instantiated using the factory methods in JavaScriptHeaderItem, CssHeaderItem, OnDomReadyHeaderItem, OnLoadHeaderItem, OnEventHeaderItem and StringHeaderItem. For example, the following code in renderHead:

  response.renderCSSReference(new CssResourceReference(HomePage.class, "header.css"));
  response.renderJavaScriptReference(new JavaScriptResourceReference(HomePage.class, "page.js"));

Needs to be replaced with:

  response.render(CssHeaderItem.forReference(new CssResourceReference(HomePage.class, "header.css")));
  response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(HomePage.class, "page.js")));

Custom HeaderResponseDecorators and IHeaderResponseFilters also need to be adjusted for the changed methods. These classes now have only one method for rendering and filtering.

package.properties renamed to wicket-package.properties

The special resource bundle that can contain resources for a whole package has been renamed from package.properties to wicket-package.properties. This prefix will be used for all wicket resources which may collide somehow with resources provided by other frameworks. See WICKET-4211

List of renamed classes and methods

Following the renames in subclasses is easier if the @Override annotations are present. IDE-s, like Eclipse, can be used to add missing @Override annotations before moving to wicket 6.

Here's a table of deprecated classes and methods in Wicket 1.5 and the corresponding replacement in Wicket 6.

Wicket 1.5 (deprecated)

Wicket 6 (replacement)

org.apache.wicket.behavior.SimpleAttributeModifier

org.apache.wicket.AttributeModifier#replace(...)

org.apache.wicket.request.Url#toAbsoluteString()

org.apache.wicket.request.Url#toString(StringMode.FULL)

Refactorings

  • HttpsMapper has been refactored to make subclassing easier
  • No labels