1 package org.apache.turbine.pipeline; 2 3 4 /* 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 */ 22 23 24 import java.io.IOException; 25 26 import org.apache.turbine.TurbineConstants; 27 import org.apache.turbine.annotation.TurbineConfiguration; 28 import org.apache.turbine.util.RunData; 29 import org.apache.turbine.util.TurbineException; 30 31 /** 32 * Implements the action portion of the "Turbine classic" processing 33 * pipeline (from the Turbine 2.x series). 34 * 35 * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> 36 * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a> 37 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 38 * @version $Id$ 39 * 40 * No replacement. Delegate session timeout to the container e.g. in web.xml, which allows to create a session at any place. 41 */ 42 @Deprecated 43 public class DefaultSessionTimeoutValve 44 implements Valve 45 { 46 @TurbineConfiguration( TurbineConstants.SESSION_TIMEOUT_KEY ) 47 protected int timeout = TurbineConstants.SESSION_TIMEOUT_DEFAULT; 48 49 /** 50 * @see org.apache.turbine.pipeline.Valve#invoke(PipelineData, ValveContext) 51 */ 52 @Override 53 public void invoke(PipelineData pipelineData, ValveContext context) 54 throws IOException, TurbineException 55 { 56 RunData runData = pipelineData.getRunData(); 57 // If the session is new take this opportunity to 58 // set the session timeout if specified in TR.properties 59 if (runData.getSession().isNew() && timeout != TurbineConstants.SESSION_TIMEOUT_DEFAULT) 60 { 61 runData.getSession().setMaxInactiveInterval(timeout); 62 } 63 64 // Pass control to the next Valve in the Pipeline 65 context.invokeNext(pipelineData); 66 } 67 }