我在我的GWT应用程序中有这样一个脏代码,我的服务层的一些类取决于一个HttpSession对象。因此,例如,在我的DAO之一(这是一个GWT-RPC端点),我有这样的事情:如何使用Guice在GWT中的服务层(DAO)类中注入HttpSession对象?
public class MyExampleDAO extends RemoteServiceServlet {
public findItems() {
// here I need to get the object session to retrieve the currently logged in user in order to query for all its items...
}
}
的问题是,我目前迁移的代码使用RequestFactory。我的DAO不再是GWT-RPC端点。所以没有必要继续扩展RemoteServiceServlet然后...
你知道我怎么能/注入(可能与Guice)我的依赖到HttpSession对象,知道我的类不再扩展RemoteServiceServlet?
非常感谢托马斯, 我会尝试,我会让你知道什么时候它的确定 再次,非常感谢您的帮助 – kaffein 2011-06-05 08:14:24
非常感谢托马斯, 它的工作;-) ...这是大 – kaffein 2011-06-08 12:45:12