You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2006/01/21 01:21:00 UTC

svn commit: r370938 [8/50] - in /struts: action/trunk/ action/trunk/conf/java/ action/trunk/src/java/org/apache/struts/ action/trunk/src/java/org/apache/struts/action/ action/trunk/src/java/org/apache/struts/chain/ action/trunk/src/java/org/apache/stru...

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/ExecuteCommand.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/ExecuteCommand.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/ExecuteCommand.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/ExecuteCommand.java Fri Jan 20 16:19:02 2006
@@ -1,154 +1,144 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.struts.chain.commands;
-
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.CatalogFactory;
-import org.apache.commons.chain.Command;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.chain.contexts.ActionContext;
-import org.apache.struts.config.ActionConfig;
-
-/**
- * <p>Invoke the appropriate <code>Command</code> for this request.  If the 
- * context's <code>ActionConfig</code> has no <code>command</code> property 
- * defined, no action will be taken.  If the specified command cannot be 
- * found, a warning will be logged, but processing will continue.  Depending 
- * on how the chain is configured, this can be used in place of an 
- * <code>Action</code> or as a method of performing pre-processing. </p>
- * 
- * <p>If used instead of an action, the command which is looked up should 
- * put an ActionForward into the context, unless it has already dealt with 
- * the response.</p>
- * 
- * @version $Id$
- */
-public class ExecuteCommand extends ActionCommandBase {
-
-
-    // ------------------------------------------------------ Instance Variables
-    private static final Log log =
-        LogFactory.getLog(ExecuteCommand.class);
-
-
-
-    // ---------------------------------------------------------- Public Methods
-
-
-    /**
-     * <p>If the <code>context</code> is "valid", lookup a command and 
-     * execute it.</p>
-     *
-     * @param actionCtx The <code>Context</code> for the current request
-     *
-     * @return the result of the lookup command's <code>execute</code> method, 
-     * if executed, or <code>false</code> if it was not executed.
-     */
-    public boolean execute(ActionContext actionCtx) throws Exception {
-        if (shouldProcess(actionCtx)) {
-
-            Command command = getCommand(actionCtx);
-
-            if (command != null) {
-                return (command.execute(actionCtx));
-            }
-
-        }
-
-        return (false) ;
-
-    }
-
-    /**
-     * <p>Evaluate the current context to see if a command should even be
-     * executed.</p>
-     * 
-     * @param context
-     * @return
-     */
-    protected boolean shouldProcess(ActionContext context) {
-        // Skip processing if the current request is not valid
-        Boolean valid = context.getFormValid();
-        return ((valid != null) && valid.booleanValue());
-
-    }
-
-    /**
-     * <p>Find the <code>ActionConfig</code> in the current context and, 
-     * if it is properly configured, lookup the appropriate 
-     * <code>commons-chain</code> command.</p>
-     * 
-     * @param context
-     * @return a <code>Command</code> to execute, or null if none is specified
-     * or if the specified command cannot be found.
-     */
-    protected Command getCommand(ActionContext context) {
-
-        ActionConfig actionConfig = context.getActionConfig();
-
-        String commandName = actionConfig.getCommand();
-
-        if (commandName == null) {
-            return null;
-        }
-
-        String catalogName = actionConfig.getCatalog();
-
-        return getCommand(commandName, catalogName);
-
-    }
-
-    /**
-     * @param commandName
-     * @param catalogName
-     * @return
-     */
-    protected Command getCommand(String commandName, String catalogName) {
-
-        if (commandName == null) {
-            return null;
-        }
-
-        Catalog catalog = null;
-
-        if (catalogName != null) {
-            catalog = CatalogFactory.getInstance().getCatalog(catalogName);
-            if (catalog == null) {
-                log.warn("When looking up " + commandName + ","
-                        + " no catalog found under " + catalogName);
-                return null;
-            }
-
-        } else {
-            catalogName = "the default catalog";
-            catalog = CatalogFactory.getInstance().getCatalog();
-            if (catalog == null) {
-                log.warn("When looking up " + commandName + ","
-                        + " no default catalog found.");
-                return null;
-            }
-        }
-
-        if (log.isDebugEnabled()) {
-            log.debug("looking up command " + commandName 
-                    + " in " + catalogName);
-        }
-        return catalog.getCommand(commandName);
-    }
-
-
-}
\ No newline at end of file
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.struts.chain.commands;
+
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.CatalogFactory;
+import org.apache.commons.chain.Command;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.chain.contexts.ActionContext;
+import org.apache.struts.config.ActionConfig;
+
+/**
+ * <p>Invoke the appropriate <code>Command</code> for this request.  If the
+ * context's <code>ActionConfig</code> has no <code>command</code> property
+ * defined, no action will be taken.  If the specified command cannot be
+ * found, a warning will be logged, but processing will continue.  Depending
+ * on how the chain is configured, this can be used in place of an
+ * <code>Action</code> or as a method of performing pre-processing. </p>
+ *
+ * <p>If used instead of an action, the command which is looked up should put
+ * an ActionForward into the context, unless it has already dealt with the
+ * response.</p>
+ *
+ * @version $Id$
+ */
+public class ExecuteCommand extends ActionCommandBase {
+    // ------------------------------------------------------ Instance Variables
+    private static final Log log = LogFactory.getLog(ExecuteCommand.class);
+
+    // ---------------------------------------------------------- Public Methods
+
+    /**
+     * <p>If the <code>context</code> is "valid", lookup a command and execute
+     * it.</p>
+     *
+     * @param actionCtx The <code>Context</code> for the current request
+     * @return the result of the lookup command's <code>execute</code> method,
+     *         if executed, or <code>false</code> if it was not executed.
+     */
+    public boolean execute(ActionContext actionCtx)
+            throws Exception {
+        if (shouldProcess(actionCtx)) {
+            Command command = getCommand(actionCtx);
+
+            if (command != null) {
+                return (command.execute(actionCtx));
+            }
+        }
+
+        return (false);
+    }
+
+    /**
+     * <p>Evaluate the current context to see if a command should even be
+     * executed.</p>
+     *
+     * @param context
+     * @return
+     */
+    protected boolean shouldProcess(ActionContext context) {
+        // Skip processing if the current request is not valid
+        Boolean valid = context.getFormValid();
+
+        return ((valid != null) && valid.booleanValue());
+    }
+
+    /**
+     * <p>Find the <code>ActionConfig</code> in the current context and, if it
+     * is properly configured, lookup the appropriate <code>commons-chain</code>
+     * command.</p>
+     *
+     * @param context
+     * @return a <code>Command</code> to execute, or null if none is specified
+     *         or if the specified command cannot be found.
+     */
+    protected Command getCommand(ActionContext context) {
+        ActionConfig actionConfig = context.getActionConfig();
+
+        String commandName = actionConfig.getCommand();
+
+        if (commandName == null) {
+            return null;
+        }
+
+        String catalogName = actionConfig.getCatalog();
+
+        return getCommand(commandName, catalogName);
+    }
+
+    /**
+     * @param commandName
+     * @param catalogName
+     * @return
+     */
+    protected Command getCommand(String commandName, String catalogName) {
+        if (commandName == null) {
+            return null;
+        }
+
+        Catalog catalog = null;
+
+        if (catalogName != null) {
+            catalog = CatalogFactory.getInstance().getCatalog(catalogName);
+
+            if (catalog == null) {
+                log.warn("When looking up " + commandName + ","
+                        + " no catalog found under " + catalogName);
+
+                return null;
+            }
+        } else {
+            catalogName = "the default catalog";
+            catalog = CatalogFactory.getInstance().getCatalog();
+
+            if (catalog == null) {
+                log.warn("When looking up " + commandName + ","
+                        + " no default catalog found.");
+
+                return null;
+            }
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("looking up command " + commandName + " in "
+                    + catalogName);
+        }
+
+        return catalog.getCommand(commandName);
+    }
+}

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/ExecuteForwardCommand.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/ExecuteForwardCommand.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/ExecuteForwardCommand.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/ExecuteForwardCommand.java Fri Jan 20 16:19:02 2006
@@ -1,56 +1,54 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.struts.chain.commands;
-
-import org.apache.commons.chain.Command;
-import org.apache.struts.chain.contexts.ActionContext;
-import org.apache.struts.config.ForwardConfig;
-
-/**
- * <p>Look up and execute a commons-chain <code>Command</code> based on 
- * properties of the ActionContext's <code>forwardConfig</code> property.
- * </p>
- */
-public class ExecuteForwardCommand extends ExecuteCommand {
-
-    /**
-     * <p>Return the command specified by the <code>command</code> and
-     * <code>catalog</code> properties of the <code>forwardConfig</code>
-     * property of the given <code>ActionContext</code>.  If 
-     * <code>forwardConfig</code> is null, return null.</p>
-     */
-    protected Command getCommand(ActionContext context) {
-        ForwardConfig forwardConfig = context.getForwardConfig();
-        if (forwardConfig == null) {
-            return null;
-        }
-        return getCommand(forwardConfig.getCommand(), 
-                forwardConfig.getCatalog());
-    }
-
-    /**
-     * @return <p><code>true</code> if the given <code>ActionContext</code> has
-     * a non-null <code>forwardConfig</code> property.</p>
-     */
-    protected boolean shouldProcess(ActionContext context) {
-        return (context.getForwardConfig() != null);
-    }
-}
-
-
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.struts.chain.commands;
+
+import org.apache.commons.chain.Command;
+import org.apache.struts.chain.contexts.ActionContext;
+import org.apache.struts.config.ForwardConfig;
+
+/**
+ * <p>Look up and execute a commons-chain <code>Command</code> based on
+ * properties of the ActionContext's <code>forwardConfig</code> property.
+ * </p>
+ */
+public class ExecuteForwardCommand extends ExecuteCommand {
+    /**
+     * <p>Return the command specified by the <code>command</code> and
+     * <code>catalog</code> properties of the <code>forwardConfig</code>
+     * property of the given <code>ActionContext</code>.  If
+     * <code>forwardConfig</code> is null, return null.</p>
+     */
+    protected Command getCommand(ActionContext context) {
+        ForwardConfig forwardConfig = context.getForwardConfig();
+
+        if (forwardConfig == null) {
+            return null;
+        }
+
+        return getCommand(forwardConfig.getCommand(),
+                forwardConfig.getCatalog());
+    }
+
+    /**
+     * @return <p><code>true</code> if the given <code>ActionContext</code>
+     *         has a non-null <code>forwardConfig</code> property.</p>
+     */
+    protected boolean shouldProcess(ActionContext context) {
+        return (context.getForwardConfig() != null);
+    }
+}

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java Fri Jan 20 16:19:02 2006
@@ -15,17 +15,20 @@
  */
 package org.apache.struts.chain.commands;
 
+
 /**
- *  <p>Exception thrown when no mapping can be found for the specified path.</p>
+ * <p>Exception thrown when no mapping can be found for the specified
+ * path.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-11-05 21:44:59 -0500 (Sat, 05 Nov 2005)
+ *          $
  */
-
 public class InvalidPathException extends Exception {
-
     private String path;
 
-    /**  Constructor */
+    /**
+     * Constructor
+     */
     public InvalidPathException() {
         super();
     }
@@ -33,8 +36,8 @@
     /**
      * Constructor.
      *
-     * @param  message  The error or warning message.
-     * @param  path The invalid path.
+     * @param message The error or warning message.
+     * @param path    The invalid path.
      */
     public InvalidPathException(String message, String path) {
         super(message);
@@ -47,6 +50,4 @@
     public String getPath() {
         return path;
     }
-
 }
-

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/SelectInclude.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/SelectInclude.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/SelectInclude.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/SelectInclude.java Fri Jan 20 16:19:02 2006
@@ -13,58 +13,49 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands;
 
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.config.ActionConfig;
 
-
 /**
- * <p>Select and cache the include for this
- * <code>ActionConfig</code> if specified.</p>
+ * <p>Select and cache the include for this <code>ActionConfig</code> if
+ * specified.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-06-04 10:58:46 -0400 (Sat, 04 Jun 2005)
+ *          $
  */
-
 public class SelectInclude extends ActionCommandBase {
-
-
     // ------------------------------------------------------ Instance Variables
-    private static final Log log =
-        LogFactory.getLog(SelectInclude.class);
-
-
+    private static final Log log = LogFactory.getLog(SelectInclude.class);
 
     // ---------------------------------------------------------- Public Methods
 
-
     /**
-     * <p>Select and cache the include uri for this
-     * <code>ActionConfig</code> if specified.</p>
+     * <p>Select and cache the include uri for this <code>ActionConfig</code>
+     * if specified.</p>
      *
      * @param actionCtx The <code>Context</code> for the current request
-     *
      * @return <code>false</code> so that processing continues
      */
-    public boolean execute(ActionContext actionCtx) throws Exception {
-
+    public boolean execute(ActionContext actionCtx)
+            throws Exception {
         // Acquire configuration objects that we need
         ActionConfig actionConfig = actionCtx.getActionConfig();
 
         // Cache an include uri if found
         String include = actionConfig.getInclude();
+
         if (include != null) {
             if (log.isDebugEnabled()) {
                 log.debug("Including " + include);
             }
+
             actionCtx.setInclude(include);
         }
-        return (false);
 
+        return (false);
     }
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/UnauthorizedActionException.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/UnauthorizedActionException.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/UnauthorizedActionException.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/UnauthorizedActionException.java Fri Jan 20 16:19:02 2006
@@ -15,28 +15,28 @@
  */
 package org.apache.struts.chain.commands;
 
+
 /**
- *  <p>Exception thrown when the chosen action mapping is not authorized
- *  for the current request.</p>
+ * <p>Exception thrown when the chosen action mapping is not authorized for
+ * the current request.</p>
  *
- *@version    $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-06-04 10:58:46 -0400 (Sat, 04 Jun 2005)
+ *          $
  */
-
 public class UnauthorizedActionException extends Exception {
-
-    /**  Constructor */
+    /**
+     * Constructor
+     */
     public UnauthorizedActionException() {
         super();
     }
 
     /**
-     *  Constructor.
+     * Constructor.
      *
-     *@param  message  The error or warning message.
+     * @param message The error or warning message.
      */
     public UnauthorizedActionException(String message) {
         super(message);
     }
-
 }
-

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/generic/CopyFormToContext.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/generic/CopyFormToContext.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/generic/CopyFormToContext.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/generic/CopyFormToContext.java Fri Jan 20 16:19:02 2006
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.generic;
 
 import org.apache.struts.action.ActionForm;
@@ -32,108 +31,108 @@
  * @version $Id$
  */
 public class CopyFormToContext extends ActionCommandBase {
-
     // ------------------------------------------------------ Instance Variables
 
     /**
-     * <p>The name of a form bean as configured in a 
-     * <code>struts-config.xml</code> file for this module.  </p>
-     * 
-     * <p> Either <code>actionPath</code> or both this and <code>scope</code> 
+     * <p>The name of a form bean as configured in a <code>struts-config.xml</code>
+     * file for this module.  </p>
+     *
+     * <p> Either <code>actionPath</code> or both this and <code>scope</code>
      * are required configuration properties.</p>
      */
     private String formName = null;
 
     /**
-     * <p>The name of a scope, such as "request" or "session" in which
-     * the form to be prepared will be placed for reference by the view and
-     * other parts of Struts.</p>
-     * 
-     * <p>Either <code>actionPath</code> or both this and <code>formName</code> 
-     * are required configuration properties.</p>
+     * <p>The name of a scope, such as "request" or "session" in which the
+     * form to be prepared will be placed for reference by the view and other
+     * parts of Struts.</p>
+     *
+     * <p>Either <code>actionPath</code> or both this and
+     * <code>formName</code> are required configuration properties.</p>
      */
     private String scope = null;
 
     /**
-     * <p>The path of an <code>&lt;action&gt;</code> mapping as configured in 
-     * a <code>struts-config.xml</code> file for this module.  This action will 
-     * be looked up, and its <code>name</code> and <code>scope</code> values 
-     * will be used as if those values were configured directly in this 
-     * instance's <code>formName</code> and <code>scope</code> properties.</p>
-     * 
-     * <p>Either <code>this</code> or both <code>scope</code> and 
+     * <p>The path of an <code>&lt;action&gt;</code> mapping as configured in
+     * a <code>struts-config.xml</code> file for this module.  This action
+     * will be looked up, and its <code>name</code> and <code>scope</code>
+     * values will be used as if those values were configured directly in this
+     * instance's <code>formName</code> and <code>scope</code>
+     * properties.</p>
+     *
+     * <p>Either <code>this</code> or both <code>scope</code> and
      * <code>formName</code> are required configuration properties.</p>
      */
     private String actionPath = null;
 
     /**
-     * The context key under which the form which was looked up will be stored.  
-     * Defaults to "actionForm" but may be overridden in cases where the 
-     * "request" ActionForm must be preserved.
+     * The context key under which the form which was looked up will be
+     * stored. Defaults to "actionForm" but may be overridden in cases where
+     * the "request" ActionForm must be preserved.
      */
     private String toKey = ActionContextBase.ACTION_FORM_KEY;
 
-    
     // ------------------------------------------------------ Properties
-    
     public String getActionPath() {
         return this.actionPath;
     }
-    
+
     public void setActionPath(String actionPath) {
         this.actionPath = actionPath;
     }
-    
+
     public String getFormName() {
         return this.formName;
     }
-    
+
     public void setFormName(String formName) {
         this.formName = formName;
     }
-    
+
     public String getScope() {
         return this.scope;
     }
-    
+
     public void setScope(String scope) {
         this.scope = scope;
     }
-    
+
     public String getToKey() {
         return this.toKey;
     }
-    
+
     public void setToKey(String toKey) {
         this.toKey = toKey;
     }
 
-
     // ------------------------------------------------------
 
     /**
-     * <p>Look up an ActionForm instance based on the configured properties of 
-     * this command and copy it into the <code>Context</code>.  After this 
-     * command successfully executes, an ActionForm instance will exist in 
-     * the specified scope and will be available, for example for backing 
-     * fields in an HTML form.  It will also be in the 
-     * <code>ActionContext</code> available for another command
-     * to do prepopulation of values or other preparation.</p>
+     * <p>Look up an ActionForm instance based on the configured properties of
+     * this command and copy it into the <code>Context</code>.  After this
+     * command successfully executes, an ActionForm instance will exist in the
+     * specified scope and will be available, for example for backing fields
+     * in an HTML form.  It will also be in the <code>ActionContext</code>
+     * available for another command to do prepopulation of values or other
+     * preparation.</p>
      */
-    public boolean execute(ActionContext actionContext) throws Exception {
-
+    public boolean execute(ActionContext actionContext)
+            throws Exception {
         ActionForm form = findOrCreateForm(actionContext);
+
         if (isEmpty(getToKey())) {
             throw new IllegalStateException(
                     "Property 'toKey' must be defined.");
         }
+
         actionContext.put(getToKey(), form);
+
         return false;
     }
 
     /**
-     * <p>Based on the properties of this command and the given 
-     * <code>ActionContext</code>, find or create an ActionForm instance for 
+     * <p>Based on the properties of this command and the given
+     * <code>ActionContext</code>, find or create an ActionForm instance for
      * preparation.</p>
      *
      * @param context
@@ -141,33 +140,32 @@
      * @throws IllegalAccessException
      * @throws InstantiationException
      */
-    protected ActionForm findOrCreateForm(ActionContext context) 
+    protected ActionForm findOrCreateForm(ActionContext context)
             throws IllegalAccessException, InstantiationException {
         String effectiveFormName = null;
         String effectiveScope = null;
-        if ( !(isEmpty(this.getActionPath())) ) {
 
+        if (!(isEmpty(this.getActionPath()))) {
             ActionConfig actionConfig = context.getModuleConfig()
-                    .findActionConfig(this.getActionPath());
+                    .findActionConfig(this
+                            .getActionPath());
 
             if (actionConfig == null) {
                 throw new IllegalArgumentException(
-                        "No ActionConfig found for path " 
-                            + this.getActionPath());
+                        "No ActionConfig found for path " + this
+                                .getActionPath());
             }
 
             effectiveFormName = actionConfig.getName();
             effectiveScope = actionConfig.getScope();
-
         } else {
             effectiveFormName = this.getFormName();
             effectiveScope = this.getScope();
         }
+
         if (isEmpty(effectiveScope) || isEmpty(effectiveFormName)) {
-            throw new IllegalStateException("Both scope ["
-                    + effectiveScope
-                    + "] and formName ["
-                    + effectiveFormName
+            throw new IllegalStateException("Both scope [" + effectiveScope
+                    + "] and formName [" + effectiveFormName
                     + "] must be defined.");
         }
 
@@ -176,16 +174,15 @@
 
     /**
      * <p>Actually find or create an instance of ActionForm configured under
-     * the form-bean-name <code>effectiveFormName</code>, looking in
-     * in the <code>ActionContext's</code> scope as identified by 
-     * <code>effectiveScope</code>. If a form is created, it will also be 
+     * the form-bean-name <code>effectiveFormName</code>, looking in in the
+     * <code>ActionContext's</code> scope as identified by
+     * <code>effectiveScope</code>. If a form is created, it will also be
      * stored in that scope.</p>
      *
      * <p><b>NOTE:</b> This specific method depends on the instance of
      * <code>ActionContext</code> which is passed being a subclass of
      * <code>ActionContextBase</code>, which implements the utility method
-     * <code>findOrCreateActionForm</code>.
-     * </p>
+     * <code>findOrCreateActionForm</code>. </p>
      *
      * @param ctx
      * @param effectiveFormName
@@ -195,35 +192,34 @@
      * @throws InstantiationException
      * @throws IllegalArgumentException
      */
-    protected ActionForm findOrCreateForm(ActionContext ctx, 
-                                          String effectiveFormName, 
-                                          String effectiveScope) 
-            throws IllegalAccessException, 
-                   InstantiationException, 
-                   IllegalArgumentException {
-        
+    protected ActionForm findOrCreateForm(ActionContext ctx,
+                                          String effectiveFormName,
+                                          String effectiveScope)
+            throws IllegalAccessException, InstantiationException,
+            IllegalArgumentException {
         ActionContextBase context;
+
         try {
             context = (ActionContextBase) ctx;
-        } catch (ClassCastException e) {
+        }
+        catch (ClassCastException e) {
             throw new IllegalStateException("ActionContext [" + ctx + "]"
                     + " must be subclass of ActionContextBase");
         }
-        ActionForm form = context.findOrCreateActionForm(
-                            effectiveFormName, effectiveScope);
+
+        ActionForm form = context.findOrCreateActionForm(effectiveFormName,
+                effectiveScope);
+
         if (form == null) {
             throw new IllegalArgumentException("No form found under scope ["
-                    + effectiveScope
-                    + "] and formName ["
-                    + effectiveFormName
+                    + effectiveScope + "] and formName [" + effectiveFormName
                     + "]");
         }
+
         return form;
     }
-    
+
     private boolean isEmpty(String test) {
-        return test == null || test.trim().length() == 0;
+        return (test == null) || (test.trim().length() == 0);
     }
-    
 }
-

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java Fri Jan 20 16:19:02 2006
@@ -1,218 +1,225 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.struts.chain.commands.generic;
-
-import org.apache.commons.beanutils.ConstructorUtils;
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.CatalogFactory;
-import org.apache.commons.chain.Command;
-import org.apache.commons.chain.Context;
-import org.apache.commons.chain.Filter;
-import org.apache.struts.chain.commands.util.ClassUtils;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Variant on chain LookupCommand which can optionally
- * wrap the context it passes to the looked up command
- * in an alternative class.
- *
- */
-public class WrappingLookupCommand implements Filter {
-
-    public WrappingLookupCommand() {
-        catalogName = null;
-        name = null;
-        nameKey = null;
-        optional = false;
-    }
-
-    // ------------------------------------------------------ Instance Variables
-    private String catalogName = null;
-    private String name = null;
-    private String nameKey = null;
-    private String wrapperClassName = null;
-    private boolean optional = false;
-
-    private static final Log log = 
-            LogFactory.getLog(WrappingLookupCommand.class);
-
-
-    public String getCatalogName() {
-        return catalogName;
-    }
-
-    public void setCatalogName(String catalogName) {
-        this.catalogName = catalogName;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getNameKey() {
-        return nameKey;
-    }
-
-    public void setNameKey(String nameKey) {
-        this.nameKey = nameKey;
-    }
-
-    public boolean isOptional() {
-        return optional;
-    }
-
-    public void setOptional(boolean optional) {
-        this.optional = optional;
-    }
-
-    public String getWrapperClassName() {
-        return wrapperClassName;
-    }
-
-    public void setWrapperClassName(String wrapperClassName) {
-        this.wrapperClassName = wrapperClassName;
-    }
-
-    public boolean execute(Context context)
-            throws Exception {
-        if (log.isTraceEnabled()) {
-            log.trace("execute ["+this+"]");
-        }
-        
-        Command command = getCommand(context);
-        if(command != null) {
-            return command.execute(getContext(context));
-        } else {
-            return false;
-        }
-    }
-
-    public boolean postprocess(Context context, Exception exception) {
-        Command command = getCommand(context);
-        if(command != null && (command instanceof Filter)) {
-            try {
-                return ((Filter)command).postprocess(
-                        getContext(context), exception);
-            }
-            catch (NoSuchMethodException ex) {
-                log.error("Error wrapping context in postprocess", ex);
-            }catch (IllegalAccessException ex) {
-                log.error("Error wrapping context in postprocess", ex);
-            }catch (InvocationTargetException ex) {
-                log.error("Error wrapping context in postprocess", ex);
-            }catch (InstantiationException ex) {
-                log.error("Error wrapping context in postprocess", ex);
-            }catch (ClassNotFoundException ex) {
-                log.error("Error wrapping context in postprocess", ex);
-            }
-        }
-        return false;
-    }
-
-    protected Command getCommand(Context context) {
-        CatalogFactory catalogFactory = CatalogFactory.getInstance();
-        String catalogName = getCatalogName();
-        Catalog catalog = null;
-        if(catalogName == null) {
-            catalog = catalogFactory.getCatalog();
-            catalogName = "{default}"; // for debugging purposes
-        } else {
-            catalog = catalogFactory.getCatalog(catalogName);
-        }
-        if(catalog == null) {
-            throw new IllegalArgumentException(
-                    "Cannot find catalog '" + catalogName + "'");
-        }
-
-        Command command = null;
-        String name = getName();
-
-        if(name == null) {
-            name = (String)context.get(getNameKey());
-        }
-
-        if(name != null) {
-            if (log.isDebugEnabled()) {
-                log.debug("Lookup command " + name 
-                        + " in catalog " + catalogName);
-            }
-            command = catalog.getCommand(name);
-            if (log.isDebugEnabled()) {
-                log.debug("Found command " + command + ";"
-                        + " optional: " + isOptional());
-            }
-            if(command == null && !isOptional()) {
-                throw new IllegalArgumentException("Cannot find command " 
-                    + "'" + name + "' in catalog '" + catalogName + "'");
-            } else {
-                return command;
-            }
-        } else {
-            throw new IllegalArgumentException("No command name");
-        }
-    }
-
-    /**
-     * <p>If the <code>wrapperClassName</code> property is not null, return a 
-     * <code>Context</code> of the type specified by 
-     * <code>wrapperClassName</code>, instantiated using a single-arg
-     * constructor which takes the <code>context</code> passed as an 
-     * argument to this method.</p>
-     * 
-     * <p>This method throws an exception if the wrapperClass cannot be found, 
-     * or if there are any errors instantiating the wrapping context.</p>
-     * 
-     * @param context
-     * @return
-     */
-    protected Context getContext(Context context)
-            throws ClassNotFoundException,
-                   InstantiationException,
-                   InvocationTargetException,
-                   IllegalAccessException,
-                   NoSuchMethodException
-    {
-        if (wrapperClassName == null) {
-            if (log.isDebugEnabled()) {
-                log.debug("No defined wrapper class; " +
-                        "returning original context.");
-            }
-            return context;
-        }
-
-        if (log.isDebugEnabled()) {
-            log.debug("Looking for wrapper class: " + wrapperClassName);
-        }
-        
-        Class wrapperClass = ClassUtils.getApplicationClass(wrapperClassName);
-        
-        if (log.isDebugEnabled()) {
-            log.debug("Instantiating wrapper class");
-        }
-        
-        return (Context) ConstructorUtils
-                .invokeConstructor(wrapperClass, new Object[] { context });
-    }
-
-}
\ No newline at end of file
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.struts.chain.commands.generic;
+
+import org.apache.commons.beanutils.ConstructorUtils;
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.CatalogFactory;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.chain.Filter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.chain.commands.util.ClassUtils;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Variant on chain LookupCommand which can optionally wrap the context it
+ * passes to the looked up command in an alternative class.
+ */
+public class WrappingLookupCommand implements Filter {
+    private static final Log log =
+            LogFactory.getLog(WrappingLookupCommand.class);
+
+    // ------------------------------------------------------ Instance Variables
+    private String catalogName = null;
+    private String name = null;
+    private String nameKey = null;
+    private String wrapperClassName = null;
+    private boolean optional = false;
+
+    public WrappingLookupCommand() {
+        catalogName = null;
+        name = null;
+        nameKey = null;
+        optional = false;
+    }
+
+    public String getCatalogName() {
+        return catalogName;
+    }
+
+    public void setCatalogName(String catalogName) {
+        this.catalogName = catalogName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getNameKey() {
+        return nameKey;
+    }
+
+    public void setNameKey(String nameKey) {
+        this.nameKey = nameKey;
+    }
+
+    public boolean isOptional() {
+        return optional;
+    }
+
+    public void setOptional(boolean optional) {
+        this.optional = optional;
+    }
+
+    public String getWrapperClassName() {
+        return wrapperClassName;
+    }
+
+    public void setWrapperClassName(String wrapperClassName) {
+        this.wrapperClassName = wrapperClassName;
+    }
+
+    public boolean execute(Context context)
+            throws Exception {
+        if (log.isTraceEnabled()) {
+            log.trace("execute [" + this + "]");
+        }
+
+        Command command = getCommand(context);
+
+        if (command != null) {
+            return command.execute(getContext(context));
+        } else {
+            return false;
+        }
+    }
+
+    public boolean postprocess(Context context, Exception exception) {
+        Command command = getCommand(context);
+
+        if ((command != null) && (command instanceof Filter)) {
+            try {
+                return ((Filter) command).postprocess(getContext(context),
+                        exception);
+            }
+            catch (NoSuchMethodException ex) {
+                log.error("Error wrapping context in postprocess", ex);
+            }
+            catch (IllegalAccessException ex) {
+                log.error("Error wrapping context in postprocess", ex);
+            }
+            catch (InvocationTargetException ex) {
+                log.error("Error wrapping context in postprocess", ex);
+            }
+            catch (InstantiationException ex) {
+                log.error("Error wrapping context in postprocess", ex);
+            }
+            catch (ClassNotFoundException ex) {
+                log.error("Error wrapping context in postprocess", ex);
+            }
+        }
+
+        return false;
+    }
+
+    protected Command getCommand(Context context) {
+        CatalogFactory catalogFactory = CatalogFactory.getInstance();
+        String catalogName = getCatalogName();
+        Catalog catalog = null;
+
+        if (catalogName == null) {
+            catalog = catalogFactory.getCatalog();
+            catalogName = "{default}"; // for debugging purposes
+        } else {
+            catalog = catalogFactory.getCatalog(catalogName);
+        }
+
+        if (catalog == null) {
+            throw new IllegalArgumentException("Cannot find catalog '"
+                    + catalogName + "'");
+        }
+
+        Command command = null;
+        String name = getName();
+
+        if (name == null) {
+            name = (String) context.get(getNameKey());
+        }
+
+        if (name != null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Lookup command " + name + " in catalog "
+                        + catalogName);
+            }
+
+            command = catalog.getCommand(name);
+
+            if (log.isDebugEnabled()) {
+                log.debug("Found command " + command + ";" + " optional: "
+                        + isOptional());
+            }
+
+            if ((command == null) && !isOptional()) {
+                throw new IllegalArgumentException(
+                        "Cannot find command " + "'"
+                                + name + "' in catalog '" + catalogName
+                                + "'");
+            } else {
+                return command;
+            }
+        } else {
+            throw new IllegalArgumentException("No command name");
+        }
+    }
+
+    /**
+     * <p>If the <code>wrapperClassName</code> property is not null, return a
+     * <code>Context</code> of the type specified by <code>wrapperClassName</code>,
+     * instantiated using a single-arg constructor which takes the
+     * <code>context</code> passed as an argument to this method.</p>
+     *
+     * <p>This method throws an exception if the wrapperClass cannot be found,
+     * or if there are any errors instantiating the wrapping context.</p>
+     *
+     * @param context
+     * @return
+     */
+    protected Context getContext(Context context)
+            throws ClassNotFoundException, InstantiationException,
+            InvocationTargetException, IllegalAccessException,
+            NoSuchMethodException {
+        if (wrapperClassName == null) {
+            if (log.isDebugEnabled()) {
+                log.debug("No defined wrapper class; "
+                        + "returning original context.");
+            }
+
+            return context;
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("Looking for wrapper class: " + wrapperClassName);
+        }
+
+        Class wrapperClass = ClassUtils.getApplicationClass(wrapperClassName);
+
+        if (log.isDebugEnabled()) {
+            log.debug("Instantiating wrapper class");
+        }
+
+        return (Context) ConstructorUtils.invokeConstructor(wrapperClass,
+                new Object[]{context});
+    }
+}

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/AuthorizeAction.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/AuthorizeAction.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/AuthorizeAction.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/AuthorizeAction.java Fri Jan 20 16:19:02 2006
@@ -13,12 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.struts.action.ActionServlet;
 import org.apache.struts.chain.commands.AbstractAuthorizeAction;
 import org.apache.struts.chain.contexts.ActionContext;
@@ -26,24 +22,21 @@
 import org.apache.struts.config.ActionConfig;
 import org.apache.struts.util.MessageResources;
 
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * <p>Determine if the action is authorized for the given roles.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-11-12 13:01:44 -0500 (Sat, 12 Nov 2005)
+ *          $
  */
-
 public class AuthorizeAction extends AbstractAuthorizeAction {
-
-
     // ------------------------------------------------------- Protected Methods
-
-
     protected boolean isAuthorized(ActionContext context, String[] roles,
-                                   ActionConfig mapping) throws Exception {
-
+                                   ActionConfig mapping)
+            throws Exception {
         // Identify the HTTP request object
-        ServletActionContext servletActionContext = 
+        ServletActionContext servletActionContext =
                 (ServletActionContext) context;
         HttpServletRequest request = servletActionContext.getRequest();
 
@@ -56,20 +49,17 @@
 
         // Default to unauthorized
         return (false);
-
     }
 
-
-    protected String getErrorMessage(ActionContext context, 
+    protected String getErrorMessage(ActionContext context,
                                      ActionConfig actionConfig) {
-        
-        ServletActionContext servletActionContext = 
+        ServletActionContext servletActionContext =
                 (ServletActionContext) context;
-        
+
         // Retrieve internal message resources
         ActionServlet servlet = servletActionContext.getActionServlet();
         MessageResources resources = servlet.getInternal();
+
         return resources.getMessage("notAuthorized", actionConfig.getPath());
     }
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/CreateAction.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/CreateAction.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/CreateAction.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/CreateAction.java Fri Jan 20 16:19:02 2006
@@ -1,84 +1,81 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.struts.chain.commands.servlet;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.Action;
-import org.apache.struts.action.ActionServlet;
-import org.apache.struts.chain.Constants;
-import org.apache.struts.chain.commands.util.ClassUtils;
-import org.apache.struts.chain.contexts.ActionContext;
-import org.apache.struts.chain.contexts.ServletActionContext;
-import org.apache.struts.config.ActionConfig;
-import org.apache.struts.config.ModuleConfig;
-
-/**
- * <p>Concrete implementation of <code>AbstractCreateAction</code>
- * for use in a Servlet API chain.  Expects that the ActionContext passed 
- * into it can safely be cast to <code>ServletActionContext</code>.</p>
- */
-public class CreateAction 
-        extends org.apache.struts.chain.commands.AbstractCreateAction {
-
-
-    // ------------------------------------------------------ Instance Variables
-    private static final Log log = LogFactory.getLog(CreateAction.class);
-
-
-    /* :TODO The Action class' dependency on having its "servlet" property set 
-     * requires this API-dependent subclass of AbstractCreateAction.
-     */
-    protected synchronized Action getAction(ActionContext context, String type,
-            ActionConfig actionConfig) throws Exception  {
-
-        ModuleConfig moduleConfig = actionConfig.getModuleConfig();
-        String actionsKey = Constants.ACTIONS_KEY + moduleConfig.getPrefix();
-        Map actions = (Map) context.getApplicationScope().get(actionsKey);
-        if (actions == null) {
-            actions = new HashMap();
-            context.getApplicationScope().put(actionsKey, actions);
-        }
-
-        Action action = null;
-
-        synchronized (actions) {
-            action = (Action) actions.get(type);
-            if (action == null) {
-                log.info("Initialize action of type: " + type);
-                action = (Action) ClassUtils.getApplicationInstance(type);
-                actions.put(type, action);
-            }
-        }
-
-        if (action.getServlet() == null) {
-            ServletActionContext saContext = (ServletActionContext) context;
-            ActionServlet actionServlet = saContext.getActionServlet();
-            action.setServlet(actionServlet);
-        }
-
-        return (action);
-
-    }
-
-
-}
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.struts.chain.commands.servlet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionServlet;
+import org.apache.struts.chain.Constants;
+import org.apache.struts.chain.commands.util.ClassUtils;
+import org.apache.struts.chain.contexts.ActionContext;
+import org.apache.struts.chain.contexts.ServletActionContext;
+import org.apache.struts.config.ActionConfig;
+import org.apache.struts.config.ModuleConfig;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p>Concrete implementation of <code>AbstractCreateAction</code> for use in
+ * a Servlet API chain.  Expects that the ActionContext passed into it can
+ * safely be cast to <code>ServletActionContext</code>.</p>
+ */
+public class CreateAction
+        extends org.apache.struts.chain.commands.AbstractCreateAction {
+    // ------------------------------------------------------ Instance Variables
+    private static final Log log = LogFactory.getLog(CreateAction.class);
+
+    /* :TODO The Action class' dependency on having its "servlet" property set
+     * requires this API-dependent subclass of AbstractCreateAction.
+     */
+    protected synchronized Action getAction(ActionContext context,
+                                            String type,
+                                            ActionConfig actionConfig)
+            throws Exception {
+        ModuleConfig moduleConfig = actionConfig.getModuleConfig();
+        String actionsKey = Constants.ACTIONS_KEY + moduleConfig.getPrefix();
+        Map actions = (Map) context.getApplicationScope().get(actionsKey);
+
+        if (actions == null) {
+            actions = new HashMap();
+            context.getApplicationScope().put(actionsKey, actions);
+        }
+
+        Action action = null;
+
+        synchronized (actions) {
+            action = (Action) actions.get(type);
+
+            if (action == null) {
+                log.info("Initialize action of type: " + type);
+                action = (Action) ClassUtils.getApplicationInstance(type);
+                actions.put(type, action);
+            }
+        }
+
+        if (action.getServlet() == null) {
+            ServletActionContext saContext = (ServletActionContext) context;
+            ActionServlet actionServlet = saContext.getActionServlet();
+
+            action.setServlet(actionServlet);
+        }
+
+        return (action);
+    }
+}

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/ExceptionHandler.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/ExceptionHandler.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/ExceptionHandler.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/ExceptionHandler.java Fri Jan 20 16:19:02 2006
@@ -13,13 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.action.ActionForm;
@@ -33,32 +28,25 @@
 import org.apache.struts.config.ForwardConfig;
 import org.apache.struts.config.ModuleConfig;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  * <p>Handle the specified exception.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class ExceptionHandler extends AbstractExceptionHandler {
-
-
     // ------------------------------------------------------ Instance Variables
-
     private static final Log log = LogFactory.getLog(ExceptionHandler.class);
 
-
-
     // ------------------------------------------------------- Protected Methods
-
-
-    protected ForwardConfig handle(ActionContext context,
-                                   Exception exception,
+    protected ForwardConfig handle(ActionContext context, Exception exception,
                                    ExceptionConfig exceptionConfig,
                                    ActionConfig actionConfig,
                                    ModuleConfig moduleConfig)
-        throws Exception {
-
+            throws Exception {
         // Look up the remaining properties needed for this handler
         ServletActionContext sacontext = (ServletActionContext) context;
         ActionForm actionForm = (ActionForm) sacontext.getActionForm();
@@ -67,16 +55,10 @@
 
         // Handle this exception
         org.apache.struts.action.ExceptionHandler handler =
-            (org.apache.struts.action.ExceptionHandler)
-            ClassUtils.getApplicationInstance(exceptionConfig.getHandler());
-        return (handler.execute(exception,
-                                exceptionConfig,
-                                (ActionMapping) actionConfig,
-                                actionForm,
-                                request,
-                                response));
+                (org.apache.struts.action.ExceptionHandler) ClassUtils
+                        .getApplicationInstance(exceptionConfig.getHandler());
 
+        return (handler.execute(exception, exceptionConfig,
+                (ActionMapping) actionConfig, actionForm, request, response));
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/ExecuteAction.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/ExecuteAction.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/ExecuteAction.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/ExecuteAction.java Fri Jan 20 16:19:02 2006
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
 import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionMapping;
@@ -26,45 +24,34 @@
 import org.apache.struts.config.ActionConfig;
 import org.apache.struts.config.ForwardConfig;
 
-
 /**
  * <p>Invoke the appropriate <code>Action</code> for this request, and cache
  * the returned <code>ActionForward</code>.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class ExecuteAction extends AbstractExecuteAction {
-
-
     // ------------------------------------------------------- Protected Methods
 
-
     /**
      * <p>Execute the specified <code>Action</code>, and return the resulting
      * <code>ActionForward</code>.</p>
      *
-     * @param context The <code>Context</code> for this request
-     * @param action The <code>Action</code> to be executed
+     * @param context      The <code>Context</code> for this request
+     * @param action       The <code>Action</code> to be executed
      * @param actionConfig The <code>ActionConfig</code> defining this action
-     * @param actionForm The <code>ActionForm</code> (if any) for
-     *  this action
-     *
-     * @exception Exception if thrown by the <code>Action</code>
+     * @param actionForm   The <code>ActionForm</code> (if any) for this
+     *                     action
+     * @throws Exception if thrown by the <code>Action</code>
      */
-    protected ForwardConfig execute(ActionContext context,
-                                    Action action,
+    protected ForwardConfig execute(ActionContext context, Action action,
                                     ActionConfig actionConfig,
                                     ActionForm actionForm)
-        throws Exception {
-
+            throws Exception {
         ServletActionContext saContext = (ServletActionContext) context;
-        return (action.execute((ActionMapping) actionConfig,
-                               actionForm,
-                               saContext.getRequest(),
-                               saContext.getResponse()));
 
+        return (action.execute((ActionMapping) actionConfig, actionForm,
+                saContext.getRequest(), saContext.getResponse()));
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PerformForward.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PerformForward.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PerformForward.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PerformForward.java Fri Jan 20 16:19:02 2006
@@ -13,65 +13,59 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.struts.action.ActionServlet;
 import org.apache.struts.chain.commands.AbstractPerformForward;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.chain.contexts.ServletActionContext;
-import org.apache.struts.config.ActionConfig;
 import org.apache.struts.config.ForwardConfig;
 import org.apache.struts.config.ModuleConfig;
 import org.apache.struts.util.MessageResources;
 import org.apache.struts.util.RequestUtils;
 
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * <p>Perform forwarding or redirection based on the specified
  * <code>ForwardConfig</code> (if any).</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-11-12 13:01:44 -0500 (Sat, 12 Nov 2005)
+ *          $
  */
-
 public class PerformForward extends AbstractPerformForward {
-
-
     // ------------------------------------------------------- Protected Methods
 
-
     /**
      * <p>Perform the appropriate processing on the specified
      * <code>ForwardConfig</code>.</p>
      *
-     * @param context The context for this request
+     * @param context       The context for this request
      * @param forwardConfig The forward to be performed
      */
-    protected void perform(ActionContext context,ForwardConfig forwardConfig)
-        throws Exception {
-
+    protected void perform(ActionContext context, ForwardConfig forwardConfig)
+            throws Exception {
         ServletActionContext sacontext = (ServletActionContext) context;
         String forwardPath = forwardConfig.getPath();
         String uri = null;
 
         if (forwardPath == null) {
             // Retrieve internal message resources
-            ActionServlet servlet =  (ActionServlet) sacontext.getActionServlet();
+            ActionServlet servlet =
+                    (ActionServlet) sacontext.getActionServlet();
             MessageResources resources = servlet.getInternal();
-            throw new IllegalArgumentException(
-                    resources.getMessage("forwardPathNull"));
+
+            throw new IllegalArgumentException(resources.getMessage(
+                    "forwardPathNull"));
         }
 
-        ModuleConfig moduleConfig  = context.getModuleConfig();
+        ModuleConfig moduleConfig = context.getModuleConfig();
+
         // Resolve module-relative paths
         if (forwardPath.startsWith("/")) {
             uri = RequestUtils.forwardURL(sacontext.getRequest(),
-                                          forwardConfig,
-                                          moduleConfig);
+                    forwardConfig, moduleConfig);
         } else {
             uri = forwardPath;
         }
@@ -83,15 +77,14 @@
             if (uri.startsWith("/")) {
                 uri = request.getContextPath() + uri;
             }
-            sacontext.getResponse().sendRedirect
-                (sacontext.getResponse().encodeRedirectURL(uri));
+
+            sacontext.getResponse().sendRedirect(sacontext.getResponse()
+                    .encodeRedirectURL(uri));
         } else {
             RequestDispatcher rd =
-                sacontext.getContext().getRequestDispatcher(uri);
+                    sacontext.getContext().getRequestDispatcher(uri);
+
             rd.forward(request, sacontext.getResponse());
         }
-
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PerformInclude.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PerformInclude.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PerformInclude.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PerformInclude.java Fri Jan 20 16:19:02 2006
@@ -13,49 +13,41 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.struts.chain.commands.AbstractPerformInclude;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.chain.contexts.ServletActionContext;
 
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.HttpServletRequest;
 
 /**
- * <p>Perform forwarding or redirection based on the specified
- * include uri (if any).</p>
+ * <p>Perform forwarding or redirection based on the specified include uri (if
+ * any).</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-11-09 00:11:45 -0500 (Wed, 09 Nov 2005)
+ *          $
  */
-
 public class PerformInclude extends AbstractPerformInclude {
-
-
     // ------------------------------------------------------- Protected Methods
 
-
     /**
-     * <p>Perform the appropriate processing on the specified
-     * include uri.</p>
+     * <p>Perform the appropriate processing on the specified include
+     * uri.</p>
      *
      * @param context The context for this request
-     * @param uri The uri to be included
+     * @param uri     The uri to be included
      */
     protected void perform(ActionContext context, String uri)
-        throws Exception {
-
+            throws Exception {
         ServletActionContext swcontext = (ServletActionContext) context;
 
         HttpServletRequest request = swcontext.getRequest();
 
         RequestDispatcher rd =
                 swcontext.getContext().getRequestDispatcher(uri);
+
         rd.forward(request, swcontext.getResponse());
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PopulateActionForm.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PopulateActionForm.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PopulateActionForm.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/PopulateActionForm.java Fri Jan 20 16:19:02 2006
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.Globals;
@@ -32,37 +30,34 @@
  * <p>Populate the form bean (if any) for this request.  Sets the multipart
  * class from the action config in the request attributes.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-11-12 13:01:44 -0500 (Sat, 12 Nov 2005)
+ *          $
  */
-
 public class PopulateActionForm extends AbstractPopulateActionForm {
-
-
-    private static final Log log = LogFactory.getLog(PopulateActionForm.class);
+    private static final Log log =
+            LogFactory.getLog(PopulateActionForm.class);
 
     // ------------------------------------------------------- Protected Methods
-
-
-    protected void populate(ActionContext context,
-                         ActionConfig actionConfig,
-                         ActionForm actionForm) throws Exception {
+    protected void populate(ActionContext context, ActionConfig actionConfig,
+                            ActionForm actionForm)
+            throws Exception {
         ServletActionContext saContext = (ServletActionContext) context;
-        RequestUtils.populate(actionForm, actionConfig.getPrefix(), 
+
+        RequestUtils.populate(actionForm, actionConfig.getPrefix(),
                 actionConfig.getSuffix(), saContext.getRequest());
     }
 
-    protected void reset(ActionContext context,
-                         ActionConfig actionConfig,
+    protected void reset(ActionContext context, ActionConfig actionConfig,
                          ActionForm actionForm) {
-
         ServletActionContext saContext = (ServletActionContext) context;
-        actionForm.reset((ActionMapping) actionConfig, saContext.getRequest());
+
+        actionForm
+                .reset((ActionMapping) actionConfig, saContext.getRequest());
 
         // Set the multipart class
         if (actionConfig.getMultipartClass() != null) {
             saContext.getRequestScope().put(Globals.MULTIPART_KEY,
-                                 actionConfig.getMultipartClass());
+                    actionConfig.getMultipartClass());
         }
-
     }
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/RequestNoCache.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/RequestNoCache.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/RequestNoCache.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/RequestNoCache.java Fri Jan 20 16:19:02 2006
@@ -13,39 +13,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
-import javax.servlet.http.HttpServletResponse;
 import org.apache.struts.chain.commands.AbstractRequestNoCache;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.chain.contexts.ServletActionContext;
 
+import javax.servlet.http.HttpServletResponse;
 
 /**
- * <p>Check to see if the controller is configured to prevent caching,
- * and if so, set the no cache HTTP response headers.</p>
+ * <p>Check to see if the controller is configured to prevent caching, and if
+ * so, set the no cache HTTP response headers.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class RequestNoCache extends AbstractRequestNoCache {
-
-
     // ------------------------------------------------------- Protected Methods
-
-
     protected void requestNoCache(ActionContext context) {
-
         ServletActionContext sacontext = (ServletActionContext) context;
         HttpServletResponse response = sacontext.getResponse();
 
         response.setHeader("Pragma", "No-cache");
         response.setHeader("Cache-Control", "no-cache,no-store,max-age=0");
         response.setDateHeader("Expires", 1);
-
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectAction.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectAction.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectAction.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectAction.java Fri Jan 20 16:19:02 2006
@@ -13,34 +13,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.struts.chain.Constants;
 import org.apache.struts.chain.commands.AbstractSelectAction;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.chain.contexts.ServletActionContext;
 import org.apache.struts.config.ModuleConfig;
 
+import javax.servlet.http.HttpServletRequest;
 
 /**
- * <p>Cache the <code>ActionConfig</code> instance for the
- * action to be used for processing this request.</p>
+ * <p>Cache the <code>ActionConfig</code> instance for the action to be used
+ * for processing this request.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class SelectAction extends AbstractSelectAction {
-
-
     // ------------------------------------------------------- Protected Methods
-
-
     protected String getPath(ActionContext context) {
-
         ServletActionContext saContext = (ServletActionContext) context;
         HttpServletRequest request = saContext.getRequest();
         String path = null;
@@ -48,42 +40,48 @@
 
         // For prefix matching, match on the path info
         path = (String) request.getAttribute(Constants.INCLUDE_PATH_INFO);
+
         if (path == null) {
             path = request.getPathInfo();
         }
 
         // For extension matching, match on the servlet path
         if (path == null) {
-            path =
-                (String) request.getAttribute(Constants.INCLUDE_SERVLET_PATH);
+            path = (String) request
+                    .getAttribute(Constants.INCLUDE_SERVLET_PATH);
+
             if (path == null) {
                 path = request.getServletPath();
             }
+
             if (path == null) {
-                throw new IllegalArgumentException
-                    ("No path information in request");
+                throw new IllegalArgumentException(
+                        "No path information in request");
             }
+
             extension = true;
         }
 
         // Strip the module prefix and extension (if any)
         ModuleConfig moduleConfig = saContext.getModuleConfig();
         String prefix = moduleConfig.getPrefix();
+
         if (!path.startsWith(prefix)) {
-            throw new IllegalArgumentException("Path does not start with '" +
-                                               prefix + "'");
+            throw new IllegalArgumentException("Path does not start with '"
+                    + prefix + "'");
         }
+
         path = path.substring(prefix.length());
+
         if (extension) {
             int slash = path.lastIndexOf("/");
             int period = path.lastIndexOf(".");
+
             if ((period >= 0) && (period > slash)) {
                 path = path.substring(0, period);
             }
         }
-        return (path);
 
+        return (path);
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectForward.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectForward.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectForward.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectForward.java Fri Jan 20 16:19:02 2006
@@ -13,46 +13,37 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.chain.commands.AbstractSelectForward;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.config.ForwardConfig;
 import org.apache.struts.config.ModuleConfig;
 
-
 /**
  * <p>Create and return a <code>ForwardConfig</code> representing the
  * specified module-relative destination.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class SelectForward extends AbstractSelectForward {
-
-
     // ------------------------------------------------------- Protected Methods
 
-
     /**
      * <p>Create and return a <code>ForwardConfig</code> representing the
      * specified module-relative destination.</p>
      *
-     * @param context The context for this request
+     * @param context      The context for this request
      * @param moduleConfig The <code>ModuleConfig</code> for this request
-     * @param uri The module-relative URI to be the destination
+     * @param uri          The module-relative URI to be the destination
      */
     protected ForwardConfig forward(ActionContext context,
-                                    ModuleConfig moduleConfig,
-                                    String uri) {
-
-        return (new ActionForward(null,  uri,
-                                  false, moduleConfig.getPrefix()));
-
+                                    ModuleConfig moduleConfig, String uri) {
+        return (new ActionForward(null,
+                uri,
+                false,
+                moduleConfig.getPrefix()));
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectInput.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectInput.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectInput.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectInput.java Fri Jan 20 16:19:02 2006
@@ -13,47 +13,38 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.chain.commands.AbstractSelectInput;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.config.ForwardConfig;
 import org.apache.struts.config.ModuleConfig;
 
-
 /**
  * <p>Validate the properties of the form bean for this request.  If there are
  * any validation errors, execute the child commands in our chain; otherwise,
  * proceed normally.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class SelectInput extends AbstractSelectInput {
-
-
     // ------------------------------------------------------- Protected Methods
 
-
     /**
      * <p>Create and return a <code>ForwardConfig</code> representing the
      * specified module-relative destination.</p>
      *
-     * @param context The context for this request
+     * @param context      The context for this request
      * @param moduleConfig The <code>ModuleConfig</code> for this request
-     * @param uri The module-relative URI to be the destination
+     * @param uri          The module-relative URI to be the destination
      */
     protected ForwardConfig forward(ActionContext context,
-                                    ModuleConfig moduleConfig,
-                                    String uri) {
-
-        return (new ActionForward(null, uri,
-                                  false, moduleConfig.getPrefix()));
-
+                                    ModuleConfig moduleConfig, String uri) {
+        return (new ActionForward(null,
+                uri,
+                false,
+                moduleConfig.getPrefix()));
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectLocale.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectLocale.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectLocale.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectLocale.java Fri Jan 20 16:19:02 2006
@@ -13,14 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
-import java.util.Locale;
-
-import javax.servlet.http.HttpSession;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.Globals;
@@ -28,46 +22,45 @@
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.chain.contexts.ServletActionContext;
 
+import javax.servlet.http.HttpSession;
+import java.util.Locale;
 
 /**
  * <p>Select the <code>Locale</code> to be used for this request.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005)
+ *          $
  */
-
 public class SelectLocale extends AbstractSelectLocale {
-
-
     private static final Log log = LogFactory.getLog(SelectLocale.class);
 
     // ------------------------------------------------------- Protected Methods
 
-
     /**
      * <p>Return the <code>Locale</code> to be used for this request.</p>
      *
      * @param context The <code>Context</code> for this request
      */
     protected Locale getLocale(ActionContext context) {
-
         ServletActionContext saContext = (ServletActionContext) context;
 
         // Has a Locale already been selected?
         HttpSession session = saContext.getRequest().getSession();
         Locale locale = (Locale) session.getAttribute(Globals.LOCALE_KEY);
+
         if (locale != null) {
             return (locale);
         }
 
         // Select and cache the Locale to be used
         locale = saContext.getRequest().getLocale();
+
         if (locale == null) {
             locale = Locale.getDefault();
         }
+
         session.setAttribute(Globals.LOCALE_KEY, locale);
-        return (locale);
 
+        return (locale);
     }
-
-
 }

Modified: struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectModule.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectModule.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectModule.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/chain/commands/servlet/SelectModule.java Fri Jan 20 16:19:02 2006
@@ -13,67 +13,61 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.struts.chain.commands.servlet;
 
-
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.struts.Globals;
 import org.apache.struts.chain.Constants;
 import org.apache.struts.chain.commands.AbstractSelectModule;
 import org.apache.struts.chain.contexts.ActionContext;
 import org.apache.struts.chain.contexts.ServletActionContext;
 
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * <p>Cache the <code>ModuleConfig</code> and <code>MessageResources</code>
- * instances for the sub-application module to be used for processing
- * this request.</p>
+ * instances for the sub-application module to be used for processing this
+ * request.</p>
  *
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-06-04 10:58:46 -0400 (Sat, 04 Jun 2005)
+ *          $
  */
-
 public class SelectModule extends AbstractSelectModule {
-
-
     // ------------------------------------------------------- Protected Methods
-
-
     protected String getPrefix(ActionContext context) {
-
         // Identify the URI from which we will match a module prefix
         ServletActionContext sacontext = (ServletActionContext) context;
         HttpServletRequest request = sacontext.getRequest();
         String uri =
-            (String) request.getAttribute(Constants.INCLUDE_SERVLET_PATH);
+                (String) request.getAttribute(Constants.INCLUDE_SERVLET_PATH);
+
         if (uri == null) {
             uri = request.getServletPath();
         }
+
         if (uri == null) {
-            throw new IllegalArgumentException
-                ("No path information in request");
+            throw new IllegalArgumentException(
+                    "No path information in request");
         }
 
         // Identify the module prefix for the current module
-        String prefix = "";  // Initialize to default prefix
-        String prefixes[] = (String[])
-            sacontext.getApplicationScope().get(Globals.MODULE_PREFIXES_KEY);
+        String prefix = ""; // Initialize to default prefix
+        String[] prefixes = (String[]) sacontext.getApplicationScope()
+                .get(Globals.MODULE_PREFIXES_KEY);
         int lastSlash = 0;
-        while (prefix.equals("") &&
-               ((lastSlash = uri.lastIndexOf("/")) > 0)) {
+
+        while (prefix.equals("") && ((lastSlash = uri.lastIndexOf("/")) > 0))
+        {
             uri = uri.substring(0, lastSlash);
+
             for (int i = 0; i < prefixes.length; i++) {
                 if (uri.equals(prefixes[i])) {
                     prefix = prefixes[i];
+
                     break;
                 }
             }
         }
 
         return (prefix);
-
     }
-
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org