/* * Copyright 2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.catalina.session; import java.util.Enumeration; import org.apache.catalina.Manager; /** *
StandardSession implementation which fixes * Bug #36541.
* *This implementation restores the synchronised access to the Session's * attributes that were removed in Tomcat 5.0.19.
* *Configure Tomcat 5.0.x to use one of the patched Manager implementations * (e.g. StandardManagerBug36541) through the Context - See * * Tomcat 5.0.x Configuration Reference.
* ** * <context> * * <manager * className="org.apache.catalina.session.StandardManagerBug36541" /> * * </context> * ** * @version 1.0 - 13th September 2005 */ public final class StandardSessionBug36541 extends StandardSession { /** * Construct a new Session associated with the specified Manager. * * @param manager The manager with which this Session is associated */ public StandardSessionBug36541(Manager manager) { super(manager); } // ------------------------------------------------------------- Bug 36541 Fix /** * synchronized call to super.getAttribute() method. */ public Object getAttribute(String name) { synchronized (attributes) { return super.getAttribute(name); } } /** * synchronized call to super.getAttributeNames() method. */ public Enumeration getAttributeNames() { synchronized (attributes) { return super.getAttributeNames(); } } /** * synchronized call to super.removeAttribute() method. */ public void removeAttribute(String name, boolean notify) { synchronized (attributes) { super.removeAttribute(name, notify); } } /** * synchronized call to super.setAttribute() method. */ public void setAttribute(String name, Object value) { synchronized (attributes) { super.setAttribute(name, value); } } /** * synchronized call to super.keys() method. */ protected String[] keys() { synchronized (attributes) { return super.keys(); } } /** * synchronized call to super.getAttributeInternal() method. */ protected Object getAttributeInternal(String name) { synchronized (attributes) { return super.getAttributeInternal(name); } } }