Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is an improvement in Wicket 7.0 which should not affect any application migrating from Wicket 6.x. But if you use Servlet 3.0's AsyncContext in IResource in Wicket 7 then make sure that your code flushes the http response after completing the request.

API changes

...

Changes to org.apache.wicket.

...

ajax.

...

json.*  Image AddedWICKET-6287 - Switch from json.org to open-json RESOLVED

Because of license issues all classes in the mentioned package have been replaced by classes of open-json (https://github.com/tdunning/open-json) which means that the basic functionality is nearly the same. Some classes however (example: org.json.HTTP) are throwing WicketRuntimeExceptions because there is no corresponding implementation in open-json, yet. json.org can be used in this case (can be found in the central maven repository) if the license conditions are accepted.

DecimalConverters' number format WICKET-5853 WICKET-5861

org.apache.wicket.util.convert.converter.AbstractDecimalConverter's #getNumberFormat() and #setNumberFormat() has been removed in favour of #newNumberFormat(). Applications using the old methods should override the new one, where they configure specifics or preserve a reference to the created NumberFormat.

org/apache/wicket/core/util/io/SerializableChecker is replaced with org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream WICKET-4817

CheckingObjectOutputStream accepts a list of org.apache.wicket.core.util.objects.checker.IObjectChecker objects which are used to check for different kind of problems during object serialization. Commit diff: d0441059e0

Use org.apache.wicket.core.util.objects.checker.ObjectSerializationChecker as a replacement.

org/apache/wicket/markup/html/border/BoxBorder is removed with no replacement WICKET-4966.

BoxBorder class has been deprecated in Wicket 6.x series

org.apache.wicket.Component#renderHead(HtmlHeaderContainer) is renamed to Component#internalRenderHead(HtmlHeaderContainer) WICKET-4964

Component#renderHead(HtmlHeaderContainer) was very similar to the usually used Component#renderHead(IHeaderResponse). So it has been renamed to avoid any confusions.

org.apache.wicket.request.resource.ResourceReference#getDependencies() now returns a mutable List<HeaderItem> WICKET-5124

The old API returned Iterable<? extends HeaderItem> and was inconvenient to override and add additional dependencies.
With the new API it is as easy as:

Code Block
borderStylesolid
titleMyResourceReference.java
@Override
public List<HeaderItem> getDependencies() {
  List<HeaderItem> dependencies = super.getDependencies();
  dependencies.add(dep1);
  dependencies.add(dep2);
  return dependencies;
}

The same is done for org.apache.wicket.markup.head.HeaderItem#getDependencies() too.

org.apache.wicket.model.StringResourceModel interpolation of null in resourceKey WICKET-5820

If a null value is interpolated into the resourceKey, it will now be represented as 'null' instead of the variableName. Thus if you had "weather.${status}=..." in your resource file, you now should use "weather.null=..." instead

CheckingObjectOutputStream accepts a list of org.apache.wicket.core.util.objects.checker.IObjectChecker objects which are used to check for different kind of problems during object serialization. Commit diff: d0441059e0

Use org.apache.wicket.core.util.objects.checker.ObjectSerializationChecker as a replacement.

org/apache/wicket/markup/html/border/BoxBorder is removed with no replacement WICKET-4966.

BoxBorder class has been deprecated in Wicket 6.x series

org.apache.wicket.Component#renderHead(HtmlHeaderContainer) is renamed to Component#internalRenderHead(HtmlHeaderContainer) WICKET-4964

Component#renderHead(HtmlHeaderContainer) was very similar to the usually used Component#renderHead(IHeaderResponse). So it has been renamed to avoid any confusions.

org.apache.wicket.request.resource.ResourceReference#getDependencies() now returns a mutable List<HeaderItem> WICKET-5124

The old API returned Iterable<? extends HeaderItem> and was inconvenient to override and add additional dependencies.
With the new API it is as easy as:

Code Block
titleMyResourceReference.java
borderStylesolid
@Override
public List<HeaderItem> getDependencies() {
  List<HeaderItem> dependencies = super.getDependencies();
  dependencies.add(dep1);
  dependencies.add(dep2);
  return dependencies;
}

The same is done for org.apache.wicket.markup.head.HeaderItem#getDependencies() too.

org.apache.wicket.model.StringResourceModel constructor accepts IModel<String> for its default value WICKET-4972

...

  • since the parameters argument type is Object..., i.e. varargs, it was hard for the compiler and runtime to differentiate the "defaultValue" from the "parameters"
  • it wasn't possible to use lazy evaluation of the default value

If in your application you have code like:

Code Block
titleMyComponent.java
borderStylesolid
StringResourceModel model = new StringResourceModel(resourceKey, model, "Some default value", new Object[] [param1, param2]);

then the simplest solution is to use Model.of("Some default value"):

...

titleMyComponent.java
borderStylesolid

...

  • the default value
  • the amount of parameters for StringResourceModel resulted in rather cryptic code indecipherable for mere mortals.

So we opted to remove most of the constructors of StringResourceModel and use a fluent API instead. For ease of migration you can use the StringResourceModelMigration class to alleviate the pain of figuring out the right way to construct your instance using the new fluent API.

Change the new StringResourceModel(...) constructor call to an invocation of StringResourceModelMigration.of(...), and then perform the Inline Method refactoring of your IDE.

 

org.apache.wicket.extensions.validation.validator.+Xyz+Validator#decorate() now works with IValidationError WICKET-5174

...

To use AjaxFormValidatingBehavior in Wicket 6.x the application code should do something like:

Code Block
borderStylesolid
titleMyComponent.java
borderStylesolid
AjaxFormValidatingBehavior.addToAllFormComponents(form, "keydown", Duration.ONE_SECOND);

...

The behavior has been reworked a bit to allow this. The new usage is:

Code Block
borderStylesolid
titleMyComponent.javaborderStylesolid
form.add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND);

or

Code Block
borderStylesolid
titleMyComponent.java
borderStylesolid
formComponent.add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND);

...

To migrate it you should do something like:

Code Block
borderStylesolid
titleOldMyTextField.java
borderStylesolid
...
@Override
protected String getInputType()
{
	return "sometype";
}
...

to

Code Block
borderStylesolid
titleNewMyTextField.java
borderStylesolid
...
@Override
protected String[] getInputTypes()
{
	return new String[] { "sometype" };
}
...

...

Note: MountMapper and its related classes are still available in 7.x but deprecated and not used by Wicket itself. They will be completely removed in Wicket 8.0.00

Renamed all *AjaxResponse classes to *PartialPageUpdate WICKET-5929

XmlAjaxResponse was renamed to XmlPartialPageUpdate (see git commit 7c40e4dafa75973bf99b34567d977f310a5f02d0) 

AuthenticatedWebApplication#onUnauthorizedPage WICKET-5490

...

Components' methods and constructors which use collections have been updated to follow best practices. List of updated components:

AbstractChoice, CheckGroup, FileUploadField, ListView, PageableListView, PropertyListView, AbstractPageableView, RefreshingView,   ListDataProvider, AjaxEditableChoiceLabel, Palette, SelectOption, SelectOptions, ChoiceFilter, ChoiceFilteredPropertyColumn 

Model#of(Collection), Model#ofList(List) and Model#ofSet(Set) have been adjusted to return collections without wildcards.

Make FormComponent#convertInput() public WICKET-5708

...

All classes from package org.apache.wicket.util.upload.** are now in org.apache.commons.fileupload.**.

For example FileItem and FileUploadException.example FileItem and FileUploadException.

Rename PageSettings#recreateMountedPagesAfterExpiry to #recreateBookmarkablePagesAfterExpiry WICKET-5829
Rename IStaticCacheableResource#getCacheableResourceStream() to #getResourceStream() WICKET-5909

Behavior changes

org.apache.wicket.request.Url#getQueryString WICKET-4664

...

Check and Radio no longer generade a CSS class attribute, encoding their group's markup id. Wicket no longer needs this - if you do, you can easily write a suitable attribute value by yourself.

FileParts must be parsed explicitly before trying to read them WICKET-5839

If a MultipartWebRequest is created manually then FileParts must be parsed explicitly with #parseFileParts(). See http://wicketinaction.com/2012/11/uploading-files-to-wicket-iresource/ for example.

Deprecated classes/methods/fields are removed WICKET-5201

...

All libraries on which Wicket modules depend are updated to their latest stable versions.
The most notable ones are:

  • Spring Framework 4.1.x
  • Guice 4.0
  • ASM 5.x
  • CGLIB 3.1
  • SLF4J 1.7.x
  • Jetty (in the quickstart) 9.12.x