migrate-1.3 has been edited by Martijn Dashorst (Dec 04, 2006).

(View changes)

Content:

Migrating to Wicket 1.3

API changes

DatePicker

the DatePicker component has been removed from the wicket-extensions package. It now lives as a separate project on http://wicket-stuff.sf.net/wicket-contrib-datepicker. If you require the datepicker to be present in your code, and don't want to use the new date picker component, then add the following depenency to your maven project (or download the distribution from sourceforge):

<dependency>
    <groupId>wicket-stuff</groupId>
    <artifactId>wicket-contrib-datepicker</artifactId>
    <version>1.2</version>
</dependency>

ISessionStore

ISessionStore had the following changes:
String getSessionId(Request request); -> String getSessionId(Request request, boolean create);
+ void onBeginRequest(Request request);
+ void onEndRequest(Request request);
+ PageMap createPageMap(String name, Session session);
By default, the creation of lasting sessions is deferred until actually needed. As long no lasting session is yet created and users are accessing stateless pages, a temporary session object is used for the current request.

Button

AjaxSubmitButton and AjaxSubmitLink now extend Button and Button extends IFormSubmittingComponent. As a result of this, method onSubmit changed from protected to public

IHeaderContributor

void renderHead(final Response response); -> void renderHead(final IHeaderResponse response);
This resulted in a couple of cascading changes, like methods onRenderHeadContribution and onRenderHeadInitContribution not being used anymore. Note that the filtering of duplicate contributions is now part of IHeaderResponse.
A common fix is this:

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");
  }
}

ISessionFactory

Session newSession() -> Session newSession(Request)

WicketServlet -> WicketFilter

In 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.

If you use a URL pattern in your filter mapping, you need to specify that also as an init-param to the WicketFilter.

<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>
    <init-param>
        <param-name>filterPath</param-name>
        <param-value>stateless</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>StatelessApplication</filter-name>
    <url-pattern>/stateless/*</url-pattern>
</filter-mapping>

Reply via email to