我不太关心 java 上的 gwt 会话。我对此有些怀疑。任何人都可以检查下面的实现是否是它需要完成的方式。
public class ServiceImpl extends RemoteServiceServlet implements Service
{
void CreateSession(String Username)
{
HttpServletRequest request = this.getThreadLocalRequest();
HttpSession session = request.getSession();
session.setAttribute("Username", Username);
}
boolean ValidateSession(String Username)
{
HttpServletRequest request = this.getThreadLocalRequest();
HttpSession session = request.getSession();
if (session.getAttribute("Username"))
{
return true;
}
return false;
}
}
这是实现这两个功能的正确方法吗???