01: package org.claros.mini.actions;
02:
03: import javax.servlet.http.HttpServletRequest;
04: import javax.servlet.http.HttpServletResponse;
05: import org.apache.struts.action.ActionForm;
06: import org.apache.struts.action.ActionForward;
07: import org.apache.struts.action.ActionMapping;
08:
09: import org.claros.commons.mail.models.ConnectionMetaHandler;
10: import org.claros.commons.mail.models.ConnectionProfile;
11: import org.claros.commons.mail.protocols.Protocol;
12: import org.claros.commons.mail.protocols.ProtocolFactory;
13: import org.claros.commons.mail.utility.Constants;
14: import org.claros.commons.models.AuthProfile;
15: import org.claros.mini.common.BaseLoggedAction;
16: import org.claros.taglibs.page.Paginator;
17: import org.claros.taglibs.page.PaginatorHandler;
18:
19: /**
20: * @version 1.0
21: * @author Umut Gökbayrak
22: */
23: public class LogoutAction extends BaseLoggedAction {
24:
25: public ActionForward myExecute(ActionMapping mapping,
26: ActionForm form, HttpServletRequest request,
27: HttpServletResponse response) throws Exception {
28:
29: ConnectionProfile profile = getConnectionProfile(request);
30: if (profile.getProtocol().equals(Constants.IMAP)) {
31: ConnectionMetaHandler handler = getConnectionHandler(request);
32: AuthProfile auth = getAuthProfile(request);
33: ProtocolFactory factory = new ProtocolFactory(profile,
34: auth, handler);
35: Protocol protocol = factory.getProtocol(null);
36: protocol.disconnect();
37: }
38:
39: PaginatorHandler page = (PaginatorHandler) request.getSession()
40: .getAttribute("paginator");
41: if (page != null) {
42: Paginator.invalidateSession(page.getId());
43: }
44:
45: request.getSession().invalidate();
46: return mapping.findForward("success");
47: }
48: }
|