Martin Grigorov-4 wrote
>
> Hi,
>
> On Fri, Jan 20, 2012 at 6:15 PM, Schnick <nick.featch@> 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]
>
In 1.4.x I override WebRequestCycle and did the redirected in onBeginRequest
method so for 1.5 overriding the AbstractRequestCycleListener's
onBeginRequest seems like the best choice. I can't override the
applicaiton's createRequestCycle method since it has been made final.
Changing the web request cycle was done to ensure that the user could not
perform any further actions till they agreed to the terms and conditions of
the website. Is their a better way to Wicket way to do this? At this point
all i can think of doing is adding redirects to each page.
I've also tried overriding newWebRequest and newWebResponse but get the
following exception when I query the web session from these methods.
java.lang.IllegalArgumentException: Argument 'requestCycle' may not be
null.
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-3-RequestCycleListener-redirection-migration-problem-tp4313664p4321330.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]