##### Coverage Report - org.apache.turbine.pipeline.DefaultSessionTimeoutValve

Classes in this File | Line Coverage | Branch Coverage | Complexity
DefaultSessionTimeoutValve |
100% | 7/7
75% | 3/4
| 3.0;3

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: DefaultSessionTimeoutValve.java 1725011 2016-01-16 17:38:47Z tv $
39 |  |
      */
40 | 45 |
     public class DefaultSessionTimeoutValve
41 |  |
         extends AbstractValve
42 |  |
     {
43 | 45 |
         @TurbineConfiguration( TurbineConstants.SESSION_TIMEOUT_KEY )
44 |  |
         protected int timeout = TurbineConstants.SESSION_TIMEOUT_DEFAULT;
45 |  |
46 |  |
         /**
47 |  |
          * @see org.apache.turbine.pipeline.Valve#invoke(PipelineData, ValveContext)
48 |  |
          */
49 |  |
         @Override
50 |  |
         public void invoke(PipelineData pipelineData, ValveContext context)
51 |  |
             throws IOException, TurbineException
52 |  |
         {
53 | 3 |
             RunData runData = getRunData(pipelineData);
54 |  |
             // If the session is new take this opportunity to
55 |  |
             // set the session timeout if specified in TR.properties
56 | 3 |
             if (runData.getSession().isNew() && timeout != TurbineConstants.SESSION_TIMEOUT_DEFAULT)
57 |  |
             {
58 | 1 |
                 runData.getSession().setMaxInactiveInterval(timeout);
59 |  |
             }
60 |  |
61 |  |
             // Pass control to the next Valve in the Pipeline
62 | 3 |
             context.invokeNext(pipelineData);
63 | 2 |
         }
64 |  |
     }