Search code examples
wicketwicket-1.5

How can I get the responsePage from a RequestCycle in Wicket 1.5?


In Wicket 1.4 I used my own WebRequestCycle to store the page in the session when it was detached - in order to implement a 'back' link.

getRequestCycleListeners().add(new AbstractRequestCycleListener() {
    @Override public void onDetach(RequestCycle cycle) {
        squirrelAwayPreviousPage(cycle);
    }
    private void squirrelAwayPreviousPage(RequestCycle cycle) {
        Page responsePage = cycle.getResponse();
        if (responsePage != null)
            ((MySession) getSession()).setPreviousPage(responsePage);
    }
}); 

Now in Wicket 1.5 WebRequestCycle has gone, and I'm supposed to use a RequestCycleListener in its place.

getRequestCycleListeners().add(new AbstractRequestCycleListener() {
    @Override public void onDetach(RequestCycle cycle) {
        squirrelAwayPreviousPage(cycle);
    }
    private void squirrelAwayPreviousPage(RequestCycle cycle) {
        Page responsePage = **cycle.getResponsePage()**;
        if (responsePage != null)
            ((MySession) getSession()).setPreviousPage(responsePage);
    }
});

But RequestCycle doesn't have a getReponsePage(). Where can I find this information?


Solution

  • See the migration guide:

    https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5 (Tracking requested and response pages)