pajarokillo
Programmer
Hi, i follow having doubts about the session control. I do the session control in the next method:
protected boolean processPreprocess(HttpServletRequest request,HttpServletResponse response){
HttpSession session = null;
UserContainer user = null;
super.processPreprocess(request,response);
session = request.getSession(false);
try{
if (session != null){
doForward((moduleConfig.findForwardConfig(IConstants.SESSION_EXPIRADA)).getPath(),request,response);
}
}
catch(IOException ex){
log.error("ERRORRRRRRRRRRRRRRRRRRRRRRRRRRRRRR: " + ex.getMessage());
}
catch(ServletException ex){
log.error("ERRORRRRRRRRRRRRRRRRRRRRRRRRRRRRRR: " + ex.getMessage());
}
return true;
}
Good, so my question is the following:
when i do request.getSession(false) it always return a HttpSession object, but when the session has expired and i do request.getSession(false) it must return null, no?, and then my session control doesn't work good.
How i can do a good session control?
protected boolean processPreprocess(HttpServletRequest request,HttpServletResponse response){
HttpSession session = null;
UserContainer user = null;
super.processPreprocess(request,response);
session = request.getSession(false);
try{
if (session != null){
doForward((moduleConfig.findForwardConfig(IConstants.SESSION_EXPIRADA)).getPath(),request,response);
}
}
catch(IOException ex){
log.error("ERRORRRRRRRRRRRRRRRRRRRRRRRRRRRRRR: " + ex.getMessage());
}
catch(ServletException ex){
log.error("ERRORRRRRRRRRRRRRRRRRRRRRRRRRRRRRR: " + ex.getMessage());
}
return true;
}
Good, so my question is the following:
when i do request.getSession(false) it always return a HttpSession object, but when the session has expired and i do request.getSession(false) it must return null, no?, and then my session control doesn't work good.
How i can do a good session control?