Client session

2 views
Skip to first unread message

mk

unread,
Jul 9, 2010, 1:48:50 PM7/9/10
to Google Web Toolkit
How to implement a client side session ( and any best practices to
implement them).
Is it to just create a static variable ?

How do two different MVP widgets share MODEL data (i.e. user input
data).

How do two different MVP widgets share VIEW data ( for example if
display of one widget is dependent on mouse click location of second
widget, than how do two widgets share view information i.e. mouse
click location).

Again, all widgets are designed using MVP and send events using
EventBus.

mk

unread,
Jul 12, 2010, 2:51:27 PM7/12/10
to Google Web Toolkit
I am sure many experts out there had already found solution to below.
Thus please respond to original question.

Peter Simun

unread,
Jul 14, 2010, 4:06:02 PM7/14/10
to Google Web Toolkit
And what about using DI (gwt-gin) for injecting the client session?
Anyway, the static client session is perfectly ok for the small
application.
You can inspire also in acris-security implementation:
http://code.google.com/p/acris/wiki/SecurityClient#Client_session

Peter

Stefan Bachert

unread,
Jul 15, 2010, 11:02:23 AM7/15/10
to Google Web Toolkit
Hi,

I am not sure what you mean with client side sessions?

Do you mean to pass the HttpSession (maybe just the id) to the client
side?

But for what reason? It is already there. Either due to url-rewriting
or by cookie.


Stefan Bachert
http://gwtworld.de

Feldman, Nir (48Upper)

unread,
Jul 15, 2010, 1:36:43 PM7/15/10
to google-we...@googlegroups.com
Regarding the MODEL, you should not have static variables, Instead you should have a singleton Service in the client side.
Create UserService Interface with one method getLoggedInUserInfo(AsyncCallBack<UserInfo>).
Whenever you need it call this interface. In the implementation you should have cache so only the first time will ask data from the server.
This way you will avoid initialization sequences of static models in the client and only once the data is required it will be fetched.
Sharing of data is threw the bus. You should have your display expose mouseClickedEvent. The presenter should capture it and fire it to the bus.
The secondPresenter should get the event and notify the second display on whatever required.

Hope it helps

Nir

Hi,


Stefan Bachert
http://gwtworld.de

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

munna kaka

unread,
Jul 15, 2010, 6:11:51 PM7/15/10
to google-we...@googlegroups.com
You wrote that

On Thu, Jul 15, 2010 at 11:36 AM, Feldman, Nir (48Upper) <nir.f...@hp.com> wrote:
Sharing of data is threw the bus. You should have your display expose mouseClickedEvent. The presenter should capture it and fire it to the bus.
The secondPresenter should get the event and notify the second display on whatever required.
 
 
Plz let me know that how first presenter can send data (say user clicked item id in first display or any data) to second presenter?
 
Above is the question, I really need answer..thanks in advance...

Prashant Hegde

unread,
Jul 15, 2010, 11:35:15 PM7/15/10
to google-we...@googlegroups.com
The way I would do is to define a application event (eg. LocationEvent<LocationHandler>) & handler encapsulating whatever data (ex. co ordinates) that you need to send and fire the event. First presenter fires the event when the mouse is clicked. Second Presenter handles the event and takes appropriate action.

Regards
Prashant
Reply all
Reply to author
Forward
0 new messages