All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.eng.spago.base.PortletSessionContainer Maven / Gradle / Ivy

/**

    Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A.

    This file is part of Spago.

    Spago is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2.1 of the License, or
    any later version.

    Spago is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Spago; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

**/
package it.eng.spago.base;

import javax.portlet.PortletSession;

public class PortletSessionContainer extends SessionContainer {

	private static final long serialVersionUID = 1L;
	private static final String SHARED_CONTAINER_NAME = "AF_SHARED_CONTAINER";

	public PortletSessionContainer() {
		super();
	}

	public PortletSessionContainer(boolean permanent) {
		super(permanent);
	}

	/* (non-Javadoc)
	 * @see it.eng.spago.base.SessionContainer#getSharedContainer()
	 */
	public synchronized SessionContainer getSharedContainer() {
		PortletSession portletSession = PortletAccess.getPortletRequest().getPortletSession();

		// Retrieve shared container from shared session
		SessionContainer sharedContainer = (SessionContainer)portletSession.getAttribute(SHARED_CONTAINER_NAME, PortletSession.APPLICATION_SCOPE);
		if (sharedContainer == null) {
			// Shared containes hasnt stored in shared session yet
			sharedContainer = super.getSharedContainer();
			portletSession.setAttribute(SHARED_CONTAINER_NAME, sharedContainer, PortletSession.APPLICATION_SCOPE);
		}
		
		return sharedContainer;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy