Source code: com/clra/web/LogoutAction.java
1 /*
2 * Copyright (c) Carnegie Lake Rowing Association 2002. All rights reserved.
3 * Distributed under the GPL license. See doc/COPYING.
4 * $RCSfile: LogoutAction.java,v $
5 * $Date: 2003/02/26 03:38:46 $
6 * $Revision: 1.2 $
7 */
8
9 /*
10 * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
11 * reserved.
12 *
13 * The Apache Software License, Version 1.1 (see licenses)
14 */
15 package com.clra.web;
16
17 import java.io.IOException;
18 import java.util.Locale;
19 import javax.servlet.ServletException;
20 import javax.servlet.http.HttpServletRequest;
21 import javax.servlet.http.HttpSession;
22 import javax.servlet.http.HttpServletResponse;
23 import org.apache.log4j.Category;
24 import org.apache.struts.action.Action;
25 import org.apache.struts.action.ActionForm;
26 import org.apache.struts.action.ActionForward;
27 import org.apache.struts.action.ActionMapping;
28 import org.apache.struts.action.ActionServlet;
29 import org.apache.struts.util.MessageResources;
30
31 /**
32 * Implementation of <strong>Action</strong> that processes a
33 * user logoff. From the struts documentation example.
34 *
35 * @author Craig R. McClanahan
36 * -- original author
37 * @author <a href="mailto:rphall@pluto.njcc.com">Rick Hall</a>
38 * -- adapted to CLRA
39 * @version $Revision: 1.2 $ $Date: 2003/02/26 03:38:46 $
40 */
41 public final class LogoutAction extends Action {
42
43 private final static String base = LogoutAction.class.getName();
44 private final static Category theLog = Category.getInstance( base );
45
46 /**
47 * Process the specified HTTP request, and create the corresponding HTTP
48 * response (or forward to another web component that will create it).
49 * Return an <code>ActionForward</code> instance describing where and how
50 * control should be forwarded, or <code>null</code> if the response has
51 * already been completed.
52 *
53 * @param mapping The ActionMapping used to select this instance
54 * @param actionForm The optional ActionForm bean for this request (if any)
55 * @param request The HTTP request we are processing
56 * @param response The HTTP response we are creating
57 *
58 * @exception IOException if an input/output error occurs
59 * @exception ServletException if a servlet exception occurs
60 */
61 public ActionForward perform(ActionMapping mapping, ActionForm form,
62 HttpServletRequest request, HttpServletResponse response)
63 throws IOException, ServletException {
64
65 System.out.println( "LogoutAction.perform..." );
66
67 // Extract attributes we will need
68 Locale locale = getLocale(request);
69 MessageResources messages = getResources();
70 HttpSession session = request.getSession();
71
72 // Process this user logoff
73 session.removeAttribute(Constants.USER_KEY);
74 session.invalidate();
75
76 // Forward control to the specified success URI
77 return (mapping.findForward("success"));
78
79 }
80
81 }
82
83 /*
84 * $Log: LogoutAction.java,v $
85 * Revision 1.2 2003/02/26 03:38:46 rphall
86 * Added copyright and GPL license
87 *
88 * Revision 1.1 2002/02/23 01:01:24 rphall
89 * Working
90 *
91 * Revision 1.2 2002/02/18 18:06:10 rphall
92 * Ran dos2unix to remove ^M (carriage return) from end of lines
93 *
94 * Revision 1.1.1.1 2002/01/03 21:57:28 rphall
95 * Initial load, 5th try, Jan-03-2002 4:57 PM
96 *
97 * Revision 1.3 2001/12/11 23:38:43 rphall
98 * Moved MemberView, MemberSet from member to web package
99 *
100 * Revision 1.2 2001/11/30 11:38:00 rphall
101 * First working version, RowingSession entity bean
102 *
103 * Revision 1.1 2001/11/23 19:40:02 rphall
104 * Major revision
105 *
106 */
107