Page Edited :
WICKET :
Migrate-1.3
Migrate-1.3 has been edited by Eelco Hillenius (Mar 10, 2007). Change summary: IPageSettings#maxPageVersions removed Migrating to Wicket 1.3
Table of contents
API changesWicketTester and MockWebApplicationMockWebApplication and WicketTester are no longer derived from WebApplication which allows to use RepeatersThe repeaters package has moved from wicket-extensions into core. The package name has been changed from wicket.extensions.markup.html.repeater to wicket.markup.repeater. Notice that only DataView and backing classes have moved, the higher level components such as the DataTable are still in wicket-extensions. Also notice that the names of classes have not changed so it should be a simple matter of ctrl-shift-o in your eclipse project to relink to the new classes. DatePickerThe DatePicker component has been removed from the wicket-extensions package, as it conflicts with the Apache license. There are two options for migration:
ISessionStoreISessionStore had the following changes: ButtonAjaxSubmitButton and AjaxSubmitLink now extend Button and Button extends IFormSubmittingComponent. As a result of this, method onSubmit changed from protected to public IHeaderContributorvoid renderHead(final Response response); -> void renderHead(final IHeaderResponse response); protected void onRenderHeadInitContribution(Response response) {
writeJsReference(response, AUTOCOMPLETE_JS);
}
should be converted to: public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderJavascriptReference(AUTOCOMPLETE_JS); } or for instance code like protected String getImplementationId() { return "ArchiveActions"; } protected void onRenderHeadContribution(Response response) { if (!isComplete()) { response.write("<script>"); response.write(getCallbackScript().toString()); response.write("</script>"); } } would be rewritten like public void renderHead(IHeaderResponse response) { if (!isComplete()) { response.renderJavascript(getCallbackScript(), "ArchiveActions"); } } ISessionFactorySession newSession() -> Session newSession(Request) WicketServlet -> WicketFilterIn Wicket 2.0 and 1.3 we now prefer using a Filter instead of a Servlet. This allows you to map your application to the root of your context and still let the container serve resources. <filter> <filter-name>StatelessApplication</filter-name> <filter-class>wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>wicket.examples.stateless.StatelessApplication</param-value> </init-param> </filter> <filter-mapping> <filter-name>StatelessApplication</filter-name> <url-pattern>/stateless/*</url-pattern> </filter-mapping> FormComponent.IVisitorThings have been refactored into interfaces here. If you previously implemented this directly, extend FormComponent.AbstractVisitor instead, and rename your formComponent() implementation to onFormComponent(). ClientPropertieswicket.protocol.http.ClientProperties was taken from the Echo2 project that uses a license which is incompatible with ASL2. It has therefore been rewritten and the usage of it has also changed. Instead of: WebClientInfo clientInfo = (WebClientInfo) Session.get().getClientInfo(); ClientProperties properties = clientInfo.getProperties(); // Before constants where used to get properties System.out.println(properties.get(ClientProperties.BROWSER_INTERNET_EXPLORER)); You now say: WebClientInfo clientInfo = (WebClientInfo) Session.get().getClientInfo(); ClientProperties properties = clientInfo.getProperties(); // Now you use a property with that name instead System.out.println(properties.isBrowserInternetExplorer()); Application settingsApplication#getSettings is now private (so you can't call nor override that anymore), and the getXxxSettings are now overridable in case you want to do fancy stuff like creating a session-dependent settings object. Methods getApplicationPages and getApplicationSettings from component are now removed in favor of the getXxxSettings methods in Application. Setting get/setDefaultLocale is removed and is does not have a replacement. Custom SessionsSession's constructor signature is now: protected Session(Application application, Request request)
The locale is not set right after construction in WebApplication, but rather in the constructor using the passed in request. You can now 'fix' the session's locale by setting it in it's constructor. Custom resource loadingIn Wicket 1.2 you could override method newMarkupResourceStream from MarkupContainer to provide a custom resource stream for loading the component's markup. The new way of letting markup containers provide custom markup is to let them implement interface IMarkupResourceStreamProvider and implement it's method getMarkupResourceStream. Additionally, a new feature is that you can provide your own markup cache key, which is used in the MarkupCache class. The only real use case for that is to let a markup container return a cache key that is null, in which case the resource won't be cached, causing Wicket to get call getMarkupResourceStream everytime the component's markup is requested. A use case for that is when you have dynamic markup (e.g. from a database) that is request/ session dependent. To achieve this, let your markup container also implement IMarkupCacheKeyProvider and let method getCacheKey return null. Test serialization setting removedThe setting IDebugSettings#SerializeSessionAttributes is removed. Instead you can use the SecondLevelCacheSessionStore, which serialized (old) pages to a second level cache (user.tmp by default). SecondLevelCacheSessionStore will (probably) be the default configured session store, but you can configure it yourself by doing in your application: /** * @see wicket.Application#newSessionStore() */ protected ISessionStore newSessionStore() { return new SecondLevelCacheSessionStore(new FilePageStore()); } Also, you can use wicket.util.Objects#checkSerializable(Object)
to check for non-serializable objects yourself. You could do this for instance in a custom session store implementation. Palette component in wicket-extensions now has default CSS.You can revert this back to 1.2.x behaviour by overriding getCSS() and returning null. IRequestCycleProcessor got simplifiedThe interface itself didn't change, but we've pulled out a redundant layer of indirection that was confusing more than it helped matters. There is now a simply class hierarchy, and WebRequestCycleProcessor is the class you'll most likely need. See for more info the JIRA issue at http://issues.apache.org/jira/browse/WICKET-287 Removed IPageSettings#maxPageVersionsThe IPageSettings#maxPageVersions is removed from 1.3. The setting is not relevant for SecondLevelCacheSessionStore (the new default session store implementation), which uses SecondLevelCachePageVersionManager. If you use HttpSessionManager or a custom one together with UndoPageVersionManager, you can provide max page versions number as a UndoPageVersionManager's constructor argument. By default this is now 20 (opposed to max int which it was earlier). See also http://issues.apache.org/jira/browse/WICKET-266 |
Unsubscribe or edit your notifications preferences