Re: wicket 1.5.3 RequestCycleListener redirection migration problem

2012-01-24 Thread Martin Grigorov
Hi,

See CryptoMapper and HttpsMapper classes and there usages in Wicket.
These are examples of root request mapper pattern in Wicket.
See https://cwiki.apache.org/confluence/display/WICKET/Request+mapping

So you can create your own AgreementRequestMapper and register it as
root mapper.
In #mapRequest(Url) impl you should check whether the current user has
agreed and return either new RenderPageRequestHandler(new
PageProvider(YourPage.class)) or delegate mapRequest() call to the
original root mapper

On Mon, Jan 23, 2012 at 7:10 PM, Schnick nick.fea...@gmail.com wrote:

 Martin Grigorov-4 wrote

 Hi,

 On Fri, Jan 20, 2012 at 6:15 PM, Schnick lt;nick.featch@gt; 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: users-unsubscribe@.apache
 For additional commands, e-mail: users-help@.apache




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscribe@.apache
 For additional commands, e-mail: users-help@.apache


 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket 1.5.3 RequestCycleListener redirection migration problem

2012-01-23 Thread Martin Grigorov
Hi,

On Fri, Jan 20, 2012 at 6:15 PM, Schnick nick.fea...@gmail.com 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket 1.5.3 RequestCycleListener redirection migration problem

2012-01-23 Thread Schnick

Martin Grigorov-4 wrote
 
 Hi,
 
 On Fri, Jan 20, 2012 at 6:15 PM, Schnick lt;nick.featch@gt; 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: users-unsubscribe@.apache
 For additional commands, e-mail: users-help@.apache

 
 
 
 -- 
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com
 
 -
 To unsubscribe, e-mail: users-unsubscribe@.apache
 For additional commands, e-mail: users-help@.apache
 

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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



wicket 1.5.3 RequestCycleListener redirection migration problem

2012-01-20 Thread Schnick
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)






--
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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org