0
我是GWTP的新手。我正在嘗試使用GWTP + Command Pattern + Spring構建應用程序。如何從GWTP CommandHandler訪問Http Session
目前我的應用程序有一個使用Spring控制器的登錄頁面,它將用戶重定向到GWT頁面。在Spring控制器中,我們可以訪問會話,因爲我們可以訪問HttpRequest對象。在GWTP命令處理程序的情況下,我找不到任何方法來訪問HttpSession。 以下是我的命令處理程序代碼 -
public class GetItemsCommandHandler extends AbstractActionHandler<GetItemsCommand, GetItemsResult>{
@Autowired
private ItemService itemService;
public GetItemsCommandHandler() {
super(GetItemsCommand.class);
}
@Override
public GetItemsResult execute(GetItemsCommand action, ExecutionContext context) throws ActionException {
// How to get User info(userid) from session??
GetItemsResult getItemsResult = new GetItemsResult();
getItemsResult.setItems(itemService.getItemsForUser(userId));
return getItemsResult;
}
}
有什麼辦法,我可以從GWTP命令處理程序訪問HttpSession的?
使用guice ??? –