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