wicketwicket-1.5wicket-6wicket-1.6wicket-7

setResponsePage() and setRequestTarget() in wicket 6.x or 7.x


I had code like below

1)
getRequestCycle().setRedirect(true);
setResponsePage(ClasAdminHome.class); Repalced with

I converted to latest version as below, no compilation error

RequestCycle.get().scheduleRequestHandlerAfterCurrent(new RenderPageRequestHandler(new PageProvider(ClasAdminHome.class), RenderPageRequestHandler.RedirectPolicy.ALWAYS_REDIRECT));

The same thing I tried for below code But am not getting the solution,

2)
getRequestCycle().setRedirect(true);
getRequestCycle().setRequestTarget(new RedirectRequestTarget(redirectUrl)); 

How can I upgrade it? is it first code I have written correct?


Solution

  • I'm not quit getting yours getRequestCycle().setRequestTarget deprecated in wicket 5.You can replace simply with below code .

    Wicket 6 or 7 You can try like this.

    getRequestCycle().scheduleRequestHandlerAfterCurrent(new RedirectRequestHandler(redirectUrl));
    

    For more info check here wicket upgrading docs