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