001package org.apache.turbine.pipeline; 002 003 004/* 005 * Licensed to the Apache Software Foundation (ASF) under one 006 * or more contributor license agreements. See the NOTICE file 007 * distributed with this work for additional information 008 * regarding copyright ownership. The ASF licenses this file 009 * to you under the Apache License, Version 2.0 (the 010 * "License"); you may not use this file except in compliance 011 * with the License. You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, 016 * software distributed under the License is distributed on an 017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 018 * KIND, either express or implied. See the License for the 019 * specific language governing permissions and limitations 020 * under the License. 021 */ 022 023 024import java.io.IOException; 025 026import org.apache.turbine.TurbineConstants; 027import org.apache.turbine.annotation.TurbineConfiguration; 028import org.apache.turbine.util.RunData; 029import org.apache.turbine.util.TurbineException; 030 031/** 032 * Implements the action portion of the "Turbine classic" processing 033 * pipeline (from the Turbine 2.x series). 034 * 035 * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> 036 * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a> 037 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 038 * @version $Id$ 039 * 040 * No replacement. Delegate session timeout to the container e.g. in web.xml, which allows to create a session at any place. 041 */ 042@Deprecated 043public class DefaultSessionTimeoutValve 044 implements Valve 045{ 046 @TurbineConfiguration( TurbineConstants.SESSION_TIMEOUT_KEY ) 047 protected int timeout = TurbineConstants.SESSION_TIMEOUT_DEFAULT; 048 049 /** 050 * @see org.apache.turbine.pipeline.Valve#invoke(PipelineData, ValveContext) 051 */ 052 @Override 053 public void invoke(PipelineData pipelineData, ValveContext context) 054 throws IOException, TurbineException 055 { 056 RunData runData = pipelineData.getRunData(); 057 // If the session is new take this opportunity to 058 // set the session timeout if specified in TR.properties 059 if (runData.getSession().isNew() && timeout != TurbineConstants.SESSION_TIMEOUT_DEFAULT) 060 { 061 runData.getSession().setMaxInactiveInterval(timeout); 062 } 063 064 // Pass control to the next Valve in the Pipeline 065 context.invokeNext(pipelineData); 066 } 067}