to add RequestCycleListeners or not to add?

2013-03-07 Thread Artur

Hi Everybody!

We just migrated from Wicket 1.4 to Wicket 6.6.
In previous version we used IRequestCycleProcessor 
newRequestCycleProcessor()
Now it is gone and all RequestCycle related methods in Application are 
final.


So we thought to add our own listener:
getRequestCycleListeners().add(new CustomRequestCycle(this));

but in documentation there is info that getRequestCycleListeners():
Returns the *unmodifiable* request list of IRequestCycleListeners in 
this application


And the question: so could I add or I couldn't my own listeners like this?


And the second question. I want to load a user with hibernate with every 
request.

And at the end of request null it.

Could I do something like this in RequestCycleListeners:
@Override
public void onBeginRequest(RequestCycle cycle) {
((CustomSession)Session.get()).loadUser();
}

@Override
public void onEndRequest(RequestCycle cycle) {
 ((CustomSession)Session.get()).detachUser();
}
}

Becouse I am not sure if RequestCycleListeners is just one for application
or unique for every session/user?


Thanks for help,
Artur


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



Re: to add RequestCycleListeners or not to add?

2013-03-07 Thread Martin Grigorov
Hi,

1) You can add custom IRCLs
2) The IRCL is shared between all sessions so do not keep state in them.
You can use RequestCycle's metadata for keeping state


On Thu, Mar 7, 2013 at 12:20 PM, Artur a_wron...@gazeta.pl wrote:

 Hi Everybody!

 We just migrated from Wicket 1.4 to Wicket 6.6.
 In previous version we used IRequestCycleProcessor
 newRequestCycleProcessor()
 Now it is gone and all RequestCycle related methods in Application are
 final.

 So we thought to add our own listener:
 getRequestCycleListeners().**add(new CustomRequestCycle(this));

 but in documentation there is info that getRequestCycleListeners():
 Returns the *unmodifiable* request list of IRequestCycleListeners in this
 application

 And the question: so could I add or I couldn't my own listeners like this?


 And the second question. I want to load a user with hibernate with every
 request.
 And at the end of request null it.

 Could I do something like this in RequestCycleListeners:
 @Override
 public void onBeginRequest(RequestCycle cycle) {
 ((CustomSession)Session.get())**.loadUser();
 }

 @Override
 public void onEndRequest(RequestCycle cycle) {
  ((CustomSession)Session.get())**.detachUser();
 }
 }

 Becouse I am not sure if RequestCycleListeners is just one for application
 or unique for every session/user?


 Thanks for help,
 Artur


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




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


Re: to add RequestCycleListeners or not to add?

2013-03-07 Thread Artur

On 2013-03-07 11:32, Martin Grigorov wrote:

Hi,

1) You can add custom IRCLs
2) The IRCL is shared between all sessions so do not keep state in them.
You can use RequestCycle's metadata for keeping state

Thanks for clarification.

And one more thing.

Is the recommended solution to set MetaData in 
RequestCycleListeners.onBeginRequest?

Or should I do this somewhere else?

And should I null the MetaData in onEndRequest or Wicket will nullify 
all MetaData automatically at the end of each request?



Thanks!
Artur



On Thu, Mar 7, 2013 at 12:20 PM, Artur a_wron...@gazeta.pl wrote:


Hi Everybody!

We just migrated from Wicket 1.4 to Wicket 6.6.
In previous version we used IRequestCycleProcessor
newRequestCycleProcessor()
Now it is gone and all RequestCycle related methods in Application are
final.

So we thought to add our own listener:
getRequestCycleListeners().**add(new CustomRequestCycle(this));

but in documentation there is info that getRequestCycleListeners():
Returns the *unmodifiable* request list of IRequestCycleListeners in this
application

And the question: so could I add or I couldn't my own listeners like this?


And the second question. I want to load a user with hibernate with every
request.
And at the end of request null it.

Could I do something like this in RequestCycleListeners:
 @Override
 public void onBeginRequest(RequestCycle cycle) {
 ((CustomSession)Session.get())**.loadUser();
 }

 @Override
 public void onEndRequest(RequestCycle cycle) {
  ((CustomSession)Session.get())**.detachUser();
 }
 }

Becouse I am not sure if RequestCycleListeners is just one for application
or unique for every session/user?


Thanks for help,
Artur


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







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



Re: to add RequestCycleListeners or not to add?

2013-03-07 Thread Martin Grigorov
On Thu, Mar 7, 2013 at 12:58 PM, Artur a_wron...@gazeta.pl wrote:

 On 2013-03-07 11:32, Martin Grigorov wrote:

 Hi,

 1) You can add custom IRCLs
 2) The IRCL is shared between all sessions so do not keep state in them.
 You can use RequestCycle's metadata for keeping state

 Thanks for clarification.

 And one more thing.

 Is the recommended solution to set MetaData in RequestCycleListeners.**
 onBeginRequest?
 Or should I do this somewhere else?


Yes, this is OK.



 And should I null the MetaData in onEndRequest or Wicket will nullify all
 MetaData automatically at the end of each request?


The RequestCycle is destroyed at the end of the request together with all
related data.




 Thanks!
 Artur


 On Thu, Mar 7, 2013 at 12:20 PM, Artur a_wron...@gazeta.pl wrote:

  Hi Everybody!

 We just migrated from Wicket 1.4 to Wicket 6.6.
 In previous version we used IRequestCycleProcessor
 newRequestCycleProcessor()
 Now it is gone and all RequestCycle related methods in Application are
 final.

 So we thought to add our own listener:
 getRequestCycleListeners().add(new CustomRequestCycle(this));


 but in documentation there is info that getRequestCycleListeners():
 Returns the *unmodifiable* request list of IRequestCycleListeners in this
 application

 And the question: so could I add or I couldn't my own listeners like
 this?


 And the second question. I want to load a user with hibernate with every
 request.
 And at the end of request null it.

 Could I do something like this in RequestCycleListeners:
  @Override
  public void onBeginRequest(RequestCycle cycle) {
  ((CustomSession)Session.get()).loadUser();

  }

  @Override
  public void onEndRequest(RequestCycle cycle) {
   ((CustomSession)Session.get()).detachUser();

  }
  }

 Becouse I am not sure if RequestCycleListeners is just one for
 application
 or unique for every session/user?


 Thanks for help,
 Artur


 --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.orghttp://apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 

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





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




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