FileDocCategorySizeDatePackage
LogoffAction.javaAPI DocExample3039Thu Jul 08 09:27:52 BST 2004org.apache.struts.webapp.example

LogoffAction

public final class LogoffAction extends org.apache.struts.action.Action
Implementation of Action that processes a user logoff.
version
$Revision: 1.13 $ $Date: 2004/03/14 06:23:44 $

Fields Summary
private Log
log
The Log instance for this application.
Constructors Summary
Methods Summary
public org.apache.struts.action.ActionForwardexecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)


    // --------------------------------------------------------- Public Methods

        // See superclass for Javadoc
      
         
         
         
         
          

        // Extract attributes we will need
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(Constants.USER_KEY);

        // Process this user logoff
        if (user != null) {
            if (log.isDebugEnabled()) {
                log.debug(
                    "LogoffAction: User '"
                        + user.getUsername()
                        + "' logged off in session "
                        + session.getId());
            }
        } else {
            if (log.isDebugEnabled()) {
                log.debug(
                    "LogoffActon: User logged off in session " + session.getId());
            }
        }
        session.removeAttribute(Constants.SUBSCRIPTION_KEY);
        session.removeAttribute(Constants.USER_KEY);
        session.invalidate();

        // Forward control to the specified success URI
        return (mapping.findForward("success"));