Injecting HTTPSession provider in ActionHandler

256 views
Skip to first unread message

Tej Sarup

unread,
Mar 4, 2011, 8:23:09 AM3/4/11
to gwt-di...@googlegroups.com
Hi there,

I have worked on GWT and am using GWT Dispatch on the server side implementing the command/action pattern. Then I faced the much discussed problem of accessing the session/request in the action handler. The gwt-dispatch folks have suggested using the Provider<HTTPSession> in the action handler?

The thing is I dont know Guice :( and I have been trying to get my head around it? I would be greatly obliged if some one could provide some direction on how to implement/inject the session provider into my action handlers?

Thank in advance!
Tej

vaishakh nadgir

unread,
Mar 4, 2011, 9:26:38 AM3/4/11
to gwt-di...@googlegroups.com
Hi,

It depends on the Dispatch server side implementation that you are using.

In Spring, you can use RequestContextHolder by registering the filter in the web.xml
In Guice, you can use Provider<HttpSession> as provided in the GWT-Dispatch example.

Regards,
VN

Tej Sarup

unread,
Mar 4, 2011, 9:34:47 AM3/4/11
to gwt-di...@googlegroups.com
VN,

Could you please provide the link to the GWT-Dispatch example? 
I would really appreciate if you guide me through this..
Thanks 
tej

vaishakh nadgir

unread,
Mar 4, 2011, 10:00:15 AM3/4/11
to gwt-di...@googlegroups.com
HI Tej,

Provider<T> is defined in javax.inject, so dont worry if you do not know Guice.
Just use the Provider<HttpSession> in every ActionHandler where you need the session.

All the best,
VN
--
Vaishakh Nadgir

M: 079 616 918 52
Reply all
Reply to author
Forward
0 new messages