我的 GWT 应用程序中有这么脏的代码,我的服务层的一些类依赖于HttpSession对象。例如,在我的一个 DAO(它是一个 GWT-RPC 端点)中,我有这样的东西:
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 吗?