Migration to Wicket 6.0Page edited by Martin Grigorov
Comment:
Add an entry about minified aware resource references
Changes (1)
Full ContentMigrating to Wicket 6.0
Environment
Repeaters
Form ProcessingValidation
AjaxUse JQuery as a backing library for Wicket Ajax functionalityApache 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. AjaxRequestTarget is an interfaceo.a.w.ajax.AjaxRequestTarget is an interface now with a default implementation o.a.w.ajax.AjaxRequestHandler. This way it will be possible to replace it with a different implementation, or mock/spy it in tests. AjaxRequestTarget target = requestCycle.find(AjaxRequestTarget.class); RequestCycle.find(Class<? extends IRequestHandler>) can be used to find the currently running or a scheduled IRequestHandler for other types too. IHeaderResponse, including decorators and filtersIHeaderResponse 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 _javascript_HeaderItem, CssHeaderItem, OnDomReadyHeaderItem, OnLoadHeaderItem, OnEventHeaderItem and StringHeaderItem. For example, the following code in renderHead: response.renderCSSReference(new CssResourceReference(HomePage.class, "header.css")); response.renderJavaScriptReference(new _javascript_ResourceReference(HomePage.class, "page.js")); Needs to be replaced with: response.render(CssHeaderItem.forReference(new CssResourceReference(HomePage.class, "header.css"))); response.render(_javascript_HeaderItem.forReference(new _javascript_ResourceReference(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. Order of Header contributions and wicket:headThe order of header contributions (including wicket:head) has changed with Wicket 6.0. By default components are visited child-first to contribute to the header. For every component, the header contribution from the markup (wicket:head) is rendered first, followed by header contributions done in the code. This means that headers contributed by the page are rendered at the bottom of the header, where they used to be at the top with Wicket 1.5. package.properties renamed to wicket-package.propertiesThe 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 methodsFollowing 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.
Refactorings
o.a.w.IComponentSource and o.a.w.ComponentSourceEntry are removedThese classes were used as placeholders for further optimizations in Component's size but were never finished. o.a.w.Component#onMarkupAttached() has been dropped in favour of o.a.w.Component#onInitialize().Both methods had the same semantics. #onMarkupAttached() was the one less used and thus got dropped. IInitializers are initialized before Application#init()All IInitializer classes configured in wicket.properties are initialized before the call to Application#init(). This way the application has the control to re-configure something that comes from external library. WICKET-4088 PackageResourceReference that can load a compressed version of a package resourceorg.apache.wicket.resource.MinifiedAwareCssResourceReference and org.apache.wicket.resource.MinifiedAwareJavaScriptResourceReference are introduced. Their usage is the same as _javascript_ResourceReference. The difference is that in development mode they will load resource.ext using the provided name while in production mode they will try to load resource.min.ext by automatically inserting .min right before the extension. If there is no such resource with that name then it will log a warning and fall back to the non-compressed version.
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence
- [CONF] Apache Wicket > Migration to Wicket 6.0 confluence