Hi, On Fri, Jan 20, 2012 at 6:15 PM, Schnick <[email protected]> wrote: > Hello all, > > I am trying to migrate to wicket 1.5.3 but am having problems. I would like > to redirect users to a particular wicket page at any given time in their > visit. I have overridden RequestCycleListener's onBeginRequest method so > that it sets the request cycles response page like so > cycle.setResponsePage(TermsAndConditionsInputPage.class); > and > scheduleRequestHandlerAfterCurrent(new RenderPageRequestHandler(new > PageProvider(TermsAndConditionsInputPage.class))) ; > > but get the following error and the desired page to redirect to is not > loaded. > java.lang.IllegalStateException: Header was already written to response! > > The following code redirects to the page I want but also generates a warning > ... java.lang.IllegalStateException: Committed > > WebResponse webResponse = (WebResponse]) cycle.getResponse(); > webResponse.sendRedirect("terms-and-conditions")); > > I would appreciate any help and thoughts on how to solve this problem. I > haven't found any posts of people redirecting from RequestCycleListener > onBeginRequest method. Is their a better approach? > > P.S in wicket 1.4.19 the code to redirect was > setRedirect(true); > setResponsePage(TermsAndConditionsInputPage.class)
In 1.5.x you need just the second line. Why do you want to do that in onBeginRequest() ? Do it where you did it in 1.4.x > > > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-3-RequestCycleListener-redirection-migration-problem-tp4313664p4313664.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
