jvanzyl 02/01/18 14:33:55
Modified: src/java/org/apache/turbine/pipeline DefaultActionValve.java
Added: src/java/org/apache/turbine/pipeline
DefaultACLCreationValve.java DefaultLoginValve.java
DefaultSessionTimeoutValve.java
DefaultSessionValidationValve.java
Log:
- some breaking apart of the the big valves into smaller valves, some
regrouping may occur, but i'd would like try and group by concern, for
example security. it should be easy to use turbine without security.
Revision Changes Path
1.5 +5 -117
jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultActionValve.java
Index: DefaultActionValve.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultActionValve.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultActionValve.java 18 Jan 2002 15:53:42 -0000 1.4
+++ DefaultActionValve.java 18 Jan 2002 22:33:55 -0000 1.5
@@ -55,10 +55,11 @@
*/
import java.io.IOException;
+
import java.util.Enumeration;
-import org.apache.commons.collections.ExtendedProperties;
-import org.apache.turbine.DynamicURI;
+import org.apache.log4j.Category;
+
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.Resolver;
@@ -70,9 +71,6 @@
import org.apache.turbine.ValveContext;
import org.apache.turbine.modules.Module;
import org.apache.turbine.modules.Action;
-import org.apache.turbine.modules.actions.AccessController;
-import org.apache.turbine.modules.actions.SessionValidator;
-import org.apache.log4j.Category;
/**
* Implements the action portion of the "Turbine classic" processing
@@ -82,7 +80,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Mike Haberman</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: DefaultActionValve.java,v 1.4 2002/01/18 15:53:42 jvanzyl Exp $
+ * @version $Id: DefaultActionValve.java,v 1.5 2002/01/18 22:33:55 jvanzyl Exp $
*/
public class DefaultActionValve
implements Valve, TurbineConstants
@@ -91,15 +89,6 @@
Category.getInstance( DefaultActionValve.class );
/**
- * The default session timeout.
- */
- protected static final int DEFAULT_TIMEOUT = -1;
-
- protected SessionValidator sessionValidator = null;
- protected AccessController accessController = null;
- protected int timeout = DEFAULT_TIMEOUT;
-
- /**
* Here we can setup objects that are thread safe and can be
* reused. We setup the session validator and the access
* controller.
@@ -107,26 +96,6 @@
public DefaultActionValve()
throws Exception
{
- Resolver r = Turbine.getResolver();
- if (r != null)
- {
- // Get the instance of the Session Validator.
- sessionValidator = (SessionValidator)
- r.getModule(ACTIONS, Turbine.getConfiguration()
- .getString(ACTION_SESSION_VALIDATOR));
-
- // Get the instance of the AccessController.
- accessController = (AccessController)
- r.getModule(ACTIONS, Turbine.getConfiguration()
- .getString(ACTION_ACCESS_CONTROLLER));
- }
-
- ExtendedProperties cfg = Turbine.getConfiguration();
- if (cfg != null)
- {
- // Get the session timeout.
- timeout = cfg.getInt(SESSION_TIMEOUT, DEFAULT_TIMEOUT);
- }
}
/**
@@ -136,8 +105,7 @@
throws IOException, TurbineException
{
try
- {
- process(data);
+ {
preExecuteAction(data);
executeAction(data);
postExecuteAction(data);
@@ -149,86 +117,6 @@
// Pass control to the next Valve in the Pipeline
context.invokeNext(data);
- }
-
- /**
- * Handles user sessions, parsing of the action from the query
- * string, and access control.
- *
- * @param data The run-time data.
- */
- protected void process(RunData data)
- throws Exception
- {
- log.debug("Entering process method");
-
- if (data.getSession().isNew())
- {
- // as the session is new take this opportunity to
- // set the session timeout if specified in TR.properties
- if (timeout != -1)
- {
- data.getSession().setMaxInactiveInterval(timeout);
- }
- }
-
- // Special case for login and logout, this must happen before the
- // session validator is executed in order either to allow a user to
- // even login, or to ensure that the session validator gets to
- // mandate its page selection policy for non-logged in users
- // after the logout has taken place.
- if (data.hasAction() &&
- data.getAction().equalsIgnoreCase
- (Turbine.getConfiguration().getString(ACTION_LOGIN)) ||
- data.getAction().equalsIgnoreCase
- (Turbine.getConfiguration().getString(ACTION_LOGOUT)))
- {
- // If a User is logging in, we should refresh the
- // session here. Invalidating session and starting a
- // new session would seem to be a good method, but I
- // (JDM) could not get this to work well (it always
- // required the user to login twice). Maybe related
- // to JServ? If we do not clear out the session, it
- // is possible a new User may accidently (if they
- // login incorrectly) continue on with information
- // associated with the previous User. Currently the
- // only keys stored in the session are "turbine.user"
- // and "turbine.acl".
- if (data.getAction().equalsIgnoreCase
- (Turbine.getConfiguration().getString(ACTION_LOGIN)))
- {
- String[] names = data.getSession().getValueNames();
- if (names != null)
- {
- for (int i = 0; i < names.length; i++)
- {
- data.getSession().removeValue(names[i]);
- }
- }
- }
-
- Action action =
- (Action) Turbine.getResolver().getModule( ACTIONS, data.getAction()
);
- action.execute(data);
- data.setAction(null);
- }
-
- // This is where the validation of the Session information
- // is performed if the user has not logged in yet, then
- // the screen is set to be Login. This also handles the
- // case of not having a screen defined by also setting the
- // screen to Login. If you want people to go to another
- // screen other than Login, you need to change that within
- // TurbineResources.properties...screen.homepage; or, you
- // can specify your own SessionValidator action.
- sessionValidator.execute(data);
-
- // Put the Access Control List into the RunData object, so
- // it is easily available to modules. It is also placed
- // into the session for serialization. Modules can null
- // out the ACL to force it to be rebuilt based on more
- // information.
- accessController.execute(data);
}
/**
1.1
jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultACLCreationValve.java
Index: DefaultACLCreationValve.java
===================================================================
package org.apache.turbine.pipeline;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.IOException;
import java.util.Enumeration;
import org.apache.log4j.Category;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.RunData;
import org.apache.turbine.Resolver;
import org.apache.turbine.TurbineException;
import org.apache.turbine.Valve;
import org.apache.turbine.ValveContext;
import org.apache.turbine.modules.actions.AccessController;
/**
* Implements the action portion of the "Turbine classic" processing
* pipeline (from the Turbine 2.x series).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @version $Id: DefaultACLCreationValve.java,v 1.1 2002/01/18 22:33:55 jvanzyl Exp $
*/
public class DefaultACLCreationValve
implements Valve, TurbineConstants
{
private static final Category log =
Category.getInstance( DefaultACLCreationValve.class );
protected AccessController accessController = null;
/**
* Here we can setup objects that are thread safe and can be
* reused. We setup the session validator and the access
* controller.
*/
public DefaultACLCreationValve()
throws Exception
{
Resolver r = Turbine.getResolver();
if (r != null)
{
// Get the instance of the AccessController.
accessController = (AccessController)
r.getModule(ACTIONS, Turbine.getConfiguration()
.getString(ACTION_ACCESS_CONTROLLER));
}
}
/**
* @see org.apache.turbine.Valve#invoke(RunData, ValveContext)
*/
public void invoke(RunData data, ValveContext context)
throws IOException, TurbineException
{
try
{
// Put the Access Control List into the RunData object, so
// it is easily available to modules. It is also placed
// into the session for serialization. Modules can null
// out the ACL to force it to be rebuilt based on more
// information.
accessController.execute(data);
}
catch (Exception e)
{
throw new TurbineException(e);
}
// Pass control to the next Valve in the Pipeline
context.invokeNext(data);
}
}
1.1
jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultLoginValve.java
Index: DefaultLoginValve.java
===================================================================
package org.apache.turbine.pipeline;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.IOException;
import java.util.Enumeration;
import org.apache.log4j.Category;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.Resolver;
import org.apache.turbine.RunData;
import org.apache.turbine.Resolver;
import org.apache.turbine.TemplateContext;
import org.apache.turbine.TurbineException;
import org.apache.turbine.Valve;
import org.apache.turbine.ValveContext;
import org.apache.turbine.modules.Action;
/**
* Handles the Login and Logout actions in the request process
* cycle.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @version $Id: DefaultLoginValve.java,v 1.1 2002/01/18 22:33:55 jvanzyl Exp $
*/
public class DefaultLoginValve
implements Valve, TurbineConstants
{
private static final Category log =
Category.getInstance( DefaultLoginValve.class );
/**
* Here we can setup objects that are thread safe and can be
* reused. We setup the session validator and the access
* controller.
*/
public DefaultLoginValve()
throws Exception
{
}
/**
* @see org.apache.turbine.Valve#invoke(RunData, ValveContext)
*/
public void invoke(RunData data, ValveContext context)
throws IOException, TurbineException
{
try
{
process(data);
}
catch (Exception e)
{
throw new TurbineException(e);
}
// Pass control to the next Valve in the Pipeline
context.invokeNext(data);
}
/**
* Handles user sessions, parsing of the action from the query
* string, and access control.
*
* @param data The run-time data.
*/
protected void process(RunData data)
throws Exception
{
// Special case for login and logout, this must happen before the
// session validator is executed in order either to allow a user to
// even login, or to ensure that the session validator gets to
// mandate its page selection policy for non-logged in users
// after the logout has taken place.
if (data.hasAction() &&
data.getAction().equalsIgnoreCase
(Turbine.getConfiguration().getString(ACTION_LOGIN)) ||
data.getAction().equalsIgnoreCase
(Turbine.getConfiguration().getString(ACTION_LOGOUT)))
{
// If a User is logging in, we should refresh the
// session here. Invalidating session and starting a
// new session would seem to be a good method, but I
// (JDM) could not get this to work well (it always
// required the user to login twice). Maybe related
// to JServ? If we do not clear out the session, it
// is possible a new User may accidently (if they
// login incorrectly) continue on with information
// associated with the previous User. Currently the
// only keys stored in the session are "turbine.user"
// and "turbine.acl".
if (data.getAction().equalsIgnoreCase
(Turbine.getConfiguration().getString(ACTION_LOGIN)))
{
String[] names = data.getSession().getValueNames();
if (names != null)
{
for (int i = 0; i < names.length; i++)
{
data.getSession().removeValue(names[i]);
}
}
}
Action action = (Action) Turbine.getResolver()
.getModule( ACTIONS, data.getAction() );
action.execute(data);
data.setAction(null);
}
}
}
1.1
jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultSessionTimeoutValve.java
Index: DefaultSessionTimeoutValve.java
===================================================================
package org.apache.turbine.pipeline;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.IOException;
import java.util.Enumeration;
import org.apache.commons.collections.ExtendedProperties;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.RunData;
import org.apache.turbine.TurbineException;
import org.apache.turbine.Valve;
import org.apache.turbine.ValveContext;
import org.apache.log4j.Category;
/**
* Implements the action portion of the "Turbine classic" processing
* pipeline (from the Turbine 2.x series).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @version $Id: DefaultSessionTimeoutValve.java,v 1.1 2002/01/18 22:33:55 jvanzyl
Exp $
*/
public class DefaultSessionTimeoutValve
implements Valve, TurbineConstants
{
private static final Category log =
Category.getInstance( DefaultSessionTimeoutValve.class );
/**
* The default session timeout.
*/
protected static final int DEFAULT_TIMEOUT = -1;
protected int timeout = DEFAULT_TIMEOUT;
/**
* Here we can setup objects that are thread safe and can be
* reused. We setup the session validator and the access
* controller.
*/
public DefaultSessionTimeoutValve()
throws Exception
{
ExtendedProperties cfg = Turbine.getConfiguration();
if (cfg != null)
{
// Get the session timeout.
timeout = cfg.getInt(SESSION_TIMEOUT, DEFAULT_TIMEOUT);
}
}
/**
* @see org.apache.turbine.Valve#invoke(RunData, ValveContext)
*/
public void invoke(RunData data, ValveContext context)
throws IOException, TurbineException
{
if (data.getSession().isNew())
{
// as the session is new take this opportunity to
// set the session timeout if specified in TR.properties
if (timeout != -1)
{
data.getSession().setMaxInactiveInterval(timeout);
}
}
// Pass control to the next Valve in the Pipeline
context.invokeNext(data);
}
}
1.1
jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultSessionValidationValve.java
Index: DefaultSessionValidationValve.java
===================================================================
package org.apache.turbine.pipeline;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.IOException;
import java.util.Enumeration;
import org.apache.commons.collections.ExtendedProperties;
import org.apache.log4j.Category;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.Resolver;
import org.apache.turbine.RunData;
import org.apache.turbine.TurbineException;
import org.apache.turbine.Valve;
import org.apache.turbine.ValveContext;
import org.apache.turbine.modules.actions.SessionValidator;
/**
* Implements the action portion of the "Turbine classic" processing
* pipeline (from the Turbine 2.x series).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @version $Id: DefaultSessionValidationValve.java,v 1.1 2002/01/18 22:33:55
jvanzyl Exp $
*/
public class DefaultSessionValidationValve
implements Valve, TurbineConstants
{
private static final Category log =
Category.getInstance( DefaultSessionValidationValve.class );
protected SessionValidator sessionValidator = null;
/**
* Here we can setup objects that are thread safe and can be
* reused. We setup the session validator and the access
* controller.
*/
public DefaultSessionValidationValve()
throws Exception
{
Resolver r = Turbine.getResolver();
if (r != null)
{
// Get the instance of the Session Validator.
sessionValidator = (SessionValidator)
r.getModule(ACTIONS, Turbine.getConfiguration()
.getString(ACTION_SESSION_VALIDATOR));
}
}
/**
* @see org.apache.turbine.Valve#invoke(RunData, ValveContext)
*/
public void invoke(RunData data, ValveContext context)
throws IOException, TurbineException
{
try
{
// This is where the validation of the Session information
// is performed if the user has not logged in yet, then
// the screen is set to be Login. This also handles the
// case of not having a screen defined by also setting the
// screen to Login. If you want people to go to another
// screen other than Login, you need to change that within
// TurbineResources.properties...screen.homepage; or, you
// can specify your own SessionValidator action.
sessionValidator.execute(data);
}
catch (Exception e)
{
throw new TurbineException(e);
}
// Pass control to the next Valve in the Pipeline
context.invokeNext(data);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>