View Javadoc

1   package org.apache.turbine.pipeline;
2   
3   
4   /*
5    * Copyright 2001-2004 The Apache Software Foundation.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License")
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  
21  import java.io.IOException;
22  
23  import org.apache.turbine.Turbine;
24  import org.apache.turbine.TurbineConstants;
25  import org.apache.turbine.modules.ActionLoader;
26  import org.apache.turbine.modules.actions.sessionvalidator.SessionValidator;
27  import org.apache.turbine.util.RunData;
28  import org.apache.turbine.util.TurbineException;
29  
30  /***
31   * Implements the action portion of the "Turbine classic" processing
32   * pipeline (from the Turbine 2.x series).
33   *
34   * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>\
35   * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
36   * @version $Id: DefaultSessionValidationValve.java 222043 2004-12-06 17:47:33Z painter $
37   */
38  public class DefaultSessionValidationValve
39      extends AbstractValve
40      implements TurbineConstants
41  {
42      protected SessionValidator sessionValidator = null;
43  
44      
45      public DefaultSessionValidationValve()
46          throws Exception
47      {
48         
49      }
50  
51      /***
52       * @see org.apache.turbine.Valve#invoke(RunData, ValveContext)
53       */
54      public void invoke(PipelineData pipelineData, ValveContext context)
55          throws IOException, TurbineException
56      {
57          try
58          {
59              // This is where the validation of the Session information
60              // is performed if the user has not logged in yet, then
61              // the screen is set to be Login. This also handles the
62              // case of not having a screen defined by also setting the
63              // screen to Login. If you want people to go to another
64              // screen other than Login, you need to change that within
65              // TurbineResources.properties...screen.homepage; or, you
66              // can specify your own SessionValidator action.
67              ActionLoader.getInstance().exec(pipelineData, 
68                      Turbine.getConfiguration().getString(ACTION_SESSION_VALIDATOR_KEY,
69                              ACTION_SESSION_VALIDATOR_DEFAULT));
70          }
71          catch (Exception e)
72          {
73              throw new TurbineException(e);
74          }            
75      
76          // Pass control to the next Valve in the Pipeline
77          context.invokeNext(pipelineData);
78      }
79  }