1 package org.apache.turbine.pipeline; 2 3 56 57 import java.io.IOException ; 58 59 import org.apache.commons.configuration.Configuration; 60 import org.apache.turbine.Turbine; 61 import org.apache.turbine.TurbineConstants; 62 import org.apache.turbine.RunData; 63 import org.apache.turbine.TurbineException; 64 import org.apache.turbine.ValveContext; 65 66 74 public class DefaultSessionTimeoutValve 75 extends AbstractValve 76 implements TurbineConstants 77 { 78 protected Integer timeout = null; 79 80 84 public DefaultSessionTimeoutValve() 85 throws Exception 86 { 87 88 } 89 90 91 92 95 public void initialize() throws Exception { 96 super.initialize(); 97 Configuration cfg = Turbine.getConfiguration(); 98 if (cfg != null) 99 { 100 if(cfg.containsKey(SESSION_TIMEOUT)){ 103 timeout = Integer.valueOf(cfg.getString(SESSION_TIMEOUT)); 104 } 105 } 106 } 107 110 public void invoke(RunData data, ValveContext context) 111 throws IOException , TurbineException 112 { 113 if (data.getSession().isNew() && timeout != null) 116 { 117 data.getSession().setMaxInactiveInterval(timeout.intValue()); 118 } 119 120 context.invokeNext(data); 122 } 123 } 124 | Popular Tags |