Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DefaultSessionValidationValve |
|
| 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.annotation.TurbineLoader; | |
29 | import org.apache.turbine.modules.Action; | |
30 | import org.apache.turbine.modules.ActionLoader; | |
31 | import org.apache.turbine.util.TurbineException; | |
32 | ||
33 | /** | |
34 | * Implements the action portion of the "Turbine classic" processing | |
35 | * pipeline (from the Turbine 2.x series). | |
36 | * | |
37 | * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>\ | |
38 | * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> | |
39 | * @version $Id: DefaultSessionValidationValve.java 1854797 2019-03-04 20:41:39Z tv $ | |
40 | */ | |
41 | 138 | public class DefaultSessionValidationValve |
42 | implements Valve | |
43 | { | |
44 | /** Injected loader instance */ | |
45 | @TurbineLoader( Action.class ) | |
46 | private ActionLoader actionLoader; | |
47 | ||
48 | 138 | @TurbineConfiguration( TurbineConstants.ACTION_SESSION_VALIDATOR_KEY ) |
49 | private String actionSessionValidator = TurbineConstants.ACTION_SESSION_VALIDATOR_DEFAULT; | |
50 | ||
51 | /** | |
52 | * @see org.apache.turbine.pipeline.Valve#invoke(PipelineData, ValveContext) | |
53 | */ | |
54 | @Override | |
55 | public void invoke(PipelineData pipelineData, ValveContext context) | |
56 | throws IOException, TurbineException | |
57 | { | |
58 | try | |
59 | { | |
60 | // This is where the validation of the Session information | |
61 | // is performed if the user has not logged in yet, then | |
62 | // the screen is set to be Login. This also handles the | |
63 | // case of not having a screen defined by also setting the | |
64 | // screen to Login. If you want people to go to another | |
65 | // screen other than Login, you need to change that within | |
66 | // TurbineResources.properties...screen.homepage; or, you | |
67 | // can specify your own SessionValidator action. | |
68 | 9 | actionLoader.exec(pipelineData, actionSessionValidator); |
69 | } | |
70 | 0 | catch (Exception e) |
71 | { | |
72 | 0 | throw new TurbineException(e); |
73 | 9 | } |
74 | ||
75 | // Pass control to the next Valve in the Pipeline | |
76 | 9 | context.invokeNext(pipelineData); |
77 | 6 | } |
78 | } |