GWT 会话管理
我对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;
}
}
这是实现这两个功能的正确方法吗???
I don't too much about gwt session on java. I've some doubts about it. Anyone can check if the implementation below is the way it needs to be done.
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;
}
}
Is this the correct way to implement these two function???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一些更正
a few correction
此LoginSecurityFAQ是一个很好的起点。
This LoginSecurityFAQ is a good place to start.