...
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.
...
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
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
...
json.* WICKET-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
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 | ||||
---|---|---|---|---|
| ||||
@Override
public List<HeaderItem> getDependencies() {
List<HeaderItem> dependencies = super.getDependencies();
dependencies.add(dep1);
dependencies.add(dep2);
return dependencies;
}
|
...
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 | ||||
---|---|---|---|---|
| ||||
@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.
org.apache.wicket.model.StringResourceModel constructor accepts IModel<String> for its default value WICKET-4972
There were two problems with the old way:
- since the parameters argument type is Object..., i.
There were two problems with the old way:
- 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 | ||||
---|---|---|---|---|
| ||||
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"):
...
title | MyComponent.java |
---|---|
borderStyle | solid |
...
- 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 | ||||||
---|---|---|---|---|---|---|
| ||||||
AjaxFormValidatingBehavior.addToAllFormComponents(form, "keydown", Duration.ONE_SECOND); |
...
The behavior has been reworked a bit to allow this. The new usage is:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
form.add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND); |
or
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
formComponent.add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND); |
...
To migrate it you should do something like:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
... @Override protected String getInputType() { return "sometype"; } ... |
to
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
... @Override protected String[] getInputTypes() { return new String[] { "sometype" }; } ... |
...
This method was needed as a workaround for some old version of Firefox that had an issue with rendering images.The flush of the headers caused problems with proper buffering of the response, e.g. when the response needs to be compressed.
org.apache.wicket.markup.html.
...
IPackageResourceGuard#acceptAbsolutePath(Class, String) now without scope parameter
The scope parameter was no longer used already, so it is now removed from the method signature.method signature. The method is renamed to IPackageResourceGuard#accept(String)
All IXyzSettings are removed WICKET-5410
...
The pattern is used to check whether a candidate String could be a version.
To allow any pattern this method can return null or Pattern.compile(".*" )
remove org.apache.wicket.markup.html.form.IChoiceRenderer interface WICKET-663
With WICKET-663 we wanted to add a new method to the interface that will allow faster lookup of an object by its id.
It wasn't easy to add this new method because it would break the API.
Since the creation of WICKET-663 until now there was no big benefit of having the interface so we decided to drop it.
a version.
To allow any pattern this method can return null or Pattern.compile(".*" )
add org.apache.wicket.markup.html.form.IChoiceRenderer#getObject(String idValue, IModel<? extends List<? extends T>> choices) method WICKET-663
This method should return the object that produces idValue when org.apache.wicket.markup.html.form.IChoiceRenderer#getIdValue(T object, int index) is calledAny custom implementations of IChoiceRenderer interface now should extend from ChoiceRenderer class.
remove org.apache.wicket.request.mapper.mount.MountMapper WICKET-4686
...
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.0.0.0
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
Make FormComponent#convertInput() public WICKET-5708
...
Model#of(Collection), Model#ofList(List) and Model#ofSet(Set) have been adjusted to return collections without wildcards.
Make FormComponent#convertInput() public WICKET-5708
The visibility of org.apache.wicket.markup.html.form.FormComponent#convertInput() method has been changed from <em>protected</em> to <em>public</em> to allow application components and behaviors to convert the input of another form component(s) during custom form (component) submit processing.
Use commons-fileupload as Maven dependency instead of keeping copies of its classes WICKET-5503
All classes from package org.apache.wicket.util.upload.** are now in org.apache.commons.fileupload.**.
For 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 yourselfgroup'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 3.2.24.1.x
- Guice 4.0
- ASM 5.xASM 4.1
- CGLIB 3.01
- SLF4J 1.7.5x
- Jetty (in the quickstart) 89.12.10x