    001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/portal/portlet/modules/actions/IGeoJetspeed16LogoutUser.java $
    002
    003    /*----------------------------------------------------------------------------
    004     This file is part of deegree, http://deegree.org/
    005     Copyright (C) 2001-2009 by:
    006       Department of Geography, University of Bonn
    007     and
    008       lat/lon GmbH
    009
    010     This library is free software; you can redistribute it and/or modify it under
    011     the terms of the GNU Lesser General Public License as published by the Free
    012     Software Foundation; either version 2.1 of the License, or (at your option)
    013     any later version.
    014     This library is distributed in the hope that it will be useful, but WITHOUT
    015     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    016     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
    017     details.
    018     You should have received a copy of the GNU Lesser General Public License
    019     along with this library; if not, write to the Free Software Foundation, Inc.,
    020     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    021
    022     Contact information:
    023
    024     lat/lon GmbH
    025     Aennchenstr. 19, 53177 Bonn
    026     Germany
    027     http://lat-lon.de/
    028
    029     Department of Geography, University of Bonn
    030     Prof. Dr. Klaus Greve
    031     Postfach 1147, 53001 Bonn
    032     Germany
    033     http://www.geographie.uni-bonn.de/deegree/
    034
    035     e-mail: info@deegree.org
    036    ----------------------------------------------------------------------------*/
    037    package org.deegree.portal.portlet.modules.actions;
    038
    039    import java.io.File;
    040    import java.util.Enumeration;
    041
    042    import javax.servlet.http.Cookie;
    043    import javax.servlet.http.HttpSession;
    044
    045    import org.apache.jetspeed.modules.actions.JLogoutUser;
    046    import org.apache.turbine.util.RunData;
    047
    048    /**
    049     *
    050     *
    051     *
    052     * @version $Revision: 18195 $
    053     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
    054     * @author last edited by: $Author: mschneider $
    055     *
    056     * @version 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
    057     *
    058     * @since 2.0
    059     */
    060    public class IGeoJetspeed16LogoutUser extends JLogoutUser {
    061
    062        @Override
    063        public void doPerform( RunData data )
    064                                throws Exception {
    065
    066            if ( data != null && data.getUserFromSession() != null ) {
    067
    068                // just perform storing of last context if users session
    069                // is still alive
    070                String user = data.getUserFromSession().getUserName();
    071                File dir = new File( data.getServletContext().getRealPath( "WEB-INF/wmc/" + user ) );
    072                HttpSession ses = data.getRequest().getSession( false );
    073                if ( ses != null ) {
    074                    LogoutUser lou = new LogoutUser();
    075                    lou.storeCurrentContexts( dir, ses );
    076                    Enumeration enumeration = ses.getAttributeNames();
    077                    while ( enumeration.hasMoreElements() ) {
    078                        ses.setAttribute( (String) enumeration.nextElement(), null );
    079                    }
    080                }
    081
    082                Cookie[] cookies = data.getRequest().getCookies();
    083                if ( cookies != null ) {
    084                    for ( int i = 0; i < cookies.length; i++ ) {
    085                        cookies[i].setMaxAge( 0 );
    086                    }
    087                }
    088            }
    089
    090            super.doPerform( data );
    091        }
    092
    093    }