Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in session control

Status
Not open for further replies.

pajarokillo

Programmer
May 3, 2004
30
0
0
ES
Hi, here is my problem, i am doing a session control in the method processPreprocess of the class MyRequestProccesor, and my code for this control is the below:

public class MerlinRequestProcessor extends RequestProcessor{
super.processPreprocess(request,response);
session = request.getSession(false);
log.info("OBJ SESSION: " + session);
if (session == null)
try{
doForward((moduleConfig.findForwardConfig (IConstants.SESSION_EXPIRED)).getPath(),request,response);
}
catch(IOException ex){
log.error("ERRORRRRRRRRRRRRRRRRRRRRRRRRRRRRRR: " + ex.getMessage());
}
catch(ServletException ex){
log.error("ERRORRRRRRRRRRRRRRRRRRRRRRRRRRRRRR: " + ex.getMessage());
}
else
log.info("SESSION OK: " + session.getId());
}

what i can to do when a IOException or ServletException a ocurred?,
how i can to do a foward a Action class when ocurr those errors?

Thanks
 
If you forward it to a action class upon the catching exception as described in the code about, since every action going through the MerlinRequestProcessor, it will then go through the MerlinRequestProcessor again. Since the user state is unchange, it end up going the same code again and most probably throws the same exception again. As a result it runs into a infinite loop of throwing/catching the same exception.

However, you can forward it to a JSP page, which can then get out of the MerlinRequestProcessor.

 
ok byam, but i think that if the error ocurr it in the method doForward it will be equal if i forward it to a action class or a JSP page, no?
 
Well according to your code, it doForward if session==null. So if it forward to another action, it will go through the MerlinRequestProcessor again. Again, the session has not change (accordint the code), so session will still be null, thus repeating the doForward() in a inifinite loop.

However, you can forward to a JSP page, which will not go through the process.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top