You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ws...@apache.org on 2006/07/12 06:49:16 UTC
svn commit: r421119 [2/4] - in /struts/struts1/trunk/core/src:
main/java/org/apache/struts/ main/java/org/apache/struts/action/
main/java/org/apache/struts/chain/
main/java/org/apache/struts/chain/commands/
main/java/org/apache/struts/chain/commands/ge...
Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java?rev=421119&r1=421118&r2=421119&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java Tue Jul 11 21:49:11 2006
@@ -1,320 +1,320 @@
-/*
- * $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;
-
-/**
- * <p>Variant on chain LookupCommand which can optionally wrap the context it
- * passes to the looked up command in an alternative class.</p>
- */
-public class WrappingLookupCommand implements Filter {
- /**
- * Provide Commons Logging instance for this class.
- */
- private static final Log LOG =
- LogFactory.getLog(WrappingLookupCommand.class);
-
- // ------------------------------------------------------ Instance Variables
-
- /**
- * <p>Field for property.</p>
- */
- private String catalogName = null;
-
- /**
- * <p>Field for property.</p>
- */
- private String name = null;
-
- /**
- * <p>Field for property.</p>
- */
- private String nameKey = null;
-
- /**
- * <p>Field for property.</p>
- */
- private String wrapperClassName = null;
-
- /**
- * <p>Field for property.</p>
- */
- private boolean optional = false;
-
- /**
- * <p>Zero-argument constructor.</p>
- */
- public WrappingLookupCommand() {
- catalogName = null;
- name = null;
- nameKey = null;
- optional = false;
- }
-
- /**
- * <p>Return CatalogName property. </p>
- *
- * @return Value of CatalogName property.
- */
- public String getCatalogName() {
- return catalogName;
- }
-
- /**
- * <p>Set CatalogName property.</p>
- *
- * @param catalogName New value for CatalogName
- */
- public void setCatalogName(String catalogName) {
- this.catalogName = catalogName;
- }
-
- /**
- * <p>Retrieve Name property.</p>
- *
- * @return Value of Name property
- */
- public String getName() {
- return name;
- }
-
- /**
- * <p>Set Name property.</p>
- *
- * @param name New value for Name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * <p>Return NameKey property.</p>
- *
- * @return Value of NameKey property.
- */
- public String getNameKey() {
- return nameKey;
- }
-
- /**
- * <p>Set NameKey property.</p>
- *
- * @param nameKey New value for NameKey
- */
- public void setNameKey(String nameKey) {
- this.nameKey = nameKey;
- }
-
- /**
- * <p>Test Optional property.</p>
- *
- * @return TRUE if Optional is TRUE.
- */
- public boolean isOptional() {
- return optional;
- }
-
- /**
- * <p>Set Optional property.</p>
- *
- * @param optional New value for Optional
- */
- public void setOptional(boolean optional) {
- this.optional = optional;
- }
-
- /**
- * <p>Return the WrapperClass property.</p>
- *
- * @return The WrapperClass property
- */
- public String getWrapperClassName() {
- return wrapperClassName;
- }
-
- /**
- * <p>Set WrappClassName property. </p>
- *
- * @param wrapperClassName The name of a WrapperClass
- */
- public void setWrapperClassName(String wrapperClassName) {
- this.wrapperClassName = wrapperClassName;
- }
-
- /**
- * <p>Invoke the Command for a Context, returning TRUE if processing
- * should halt.</p>
- *
- * @param context Our ActionContext
- * @return TRUE if processing should halt
- * @throws Exception On any error
- */
- 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;
- }
- }
-
- /**
- * <p>Process the Exception for any Command that is a filter.</p>
- *
- * @param context Our ActionContext
- * @param exception The Exception thrown by another Comamnd in a Chain
- * @return TRUE if there is a Filter to process
- */
- 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;
- }
-
- /**
- * <p>Return the Command to process for this Context.</p>
- *
- * @param context The Context we are processing
- * @return The Command to process for this Context
- */
- protected Command getCommand(Context context) {
- CatalogFactory catalogFactory = CatalogFactory.getInstance();
- String catalogName = getCatalogName();
- Catalog catalog;
-
- 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;
- 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 wrapperClassName property is not null, return a Context of
- * the type specified by wrapperClassName, instantiated using a single-arg
- * constructor which takes the context 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 Context we are processing
- * @return Context wrapper
- * @throws ClassNotFoundException On failed instantiation
- * @throws InstantiationException On failed instantiation
- * @throws InvocationTargetException On failed instantiation
- * @throws IllegalAccessException On failed instantiation
- * @throws NoSuchMethodException On failed instantiation
- */
- 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 });
- }
-}
+/*
+ * $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;
+
+/**
+ * <p>Variant on chain LookupCommand which can optionally wrap the context it
+ * passes to the looked up command in an alternative class.</p>
+ */
+public class WrappingLookupCommand implements Filter {
+ /**
+ * Provide Commons Logging instance for this class.
+ */
+ private static final Log LOG =
+ LogFactory.getLog(WrappingLookupCommand.class);
+
+ // ------------------------------------------------------ Instance Variables
+
+ /**
+ * <p>Field for property.</p>
+ */
+ private String catalogName = null;
+
+ /**
+ * <p>Field for property.</p>
+ */
+ private String name = null;
+
+ /**
+ * <p>Field for property.</p>
+ */
+ private String nameKey = null;
+
+ /**
+ * <p>Field for property.</p>
+ */
+ private String wrapperClassName = null;
+
+ /**
+ * <p>Field for property.</p>
+ */
+ private boolean optional = false;
+
+ /**
+ * <p>Zero-argument constructor.</p>
+ */
+ public WrappingLookupCommand() {
+ catalogName = null;
+ name = null;
+ nameKey = null;
+ optional = false;
+ }
+
+ /**
+ * <p>Return CatalogName property. </p>
+ *
+ * @return Value of CatalogName property.
+ */
+ public String getCatalogName() {
+ return catalogName;
+ }
+
+ /**
+ * <p>Set CatalogName property.</p>
+ *
+ * @param catalogName New value for CatalogName
+ */
+ public void setCatalogName(String catalogName) {
+ this.catalogName = catalogName;
+ }
+
+ /**
+ * <p>Retrieve Name property.</p>
+ *
+ * @return Value of Name property
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <p>Set Name property.</p>
+ *
+ * @param name New value for Name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * <p>Return NameKey property.</p>
+ *
+ * @return Value of NameKey property.
+ */
+ public String getNameKey() {
+ return nameKey;
+ }
+
+ /**
+ * <p>Set NameKey property.</p>
+ *
+ * @param nameKey New value for NameKey
+ */
+ public void setNameKey(String nameKey) {
+ this.nameKey = nameKey;
+ }
+
+ /**
+ * <p>Test Optional property.</p>
+ *
+ * @return TRUE if Optional is TRUE.
+ */
+ public boolean isOptional() {
+ return optional;
+ }
+
+ /**
+ * <p>Set Optional property.</p>
+ *
+ * @param optional New value for Optional
+ */
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+ /**
+ * <p>Return the WrapperClass property.</p>
+ *
+ * @return The WrapperClass property
+ */
+ public String getWrapperClassName() {
+ return wrapperClassName;
+ }
+
+ /**
+ * <p>Set WrappClassName property. </p>
+ *
+ * @param wrapperClassName The name of a WrapperClass
+ */
+ public void setWrapperClassName(String wrapperClassName) {
+ this.wrapperClassName = wrapperClassName;
+ }
+
+ /**
+ * <p>Invoke the Command for a Context, returning TRUE if processing
+ * should halt.</p>
+ *
+ * @param context Our ActionContext
+ * @return TRUE if processing should halt
+ * @throws Exception On any error
+ */
+ 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;
+ }
+ }
+
+ /**
+ * <p>Process the Exception for any Command that is a filter.</p>
+ *
+ * @param context Our ActionContext
+ * @param exception The Exception thrown by another Comamnd in a Chain
+ * @return TRUE if there is a Filter to process
+ */
+ 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;
+ }
+
+ /**
+ * <p>Return the Command to process for this Context.</p>
+ *
+ * @param context The Context we are processing
+ * @return The Command to process for this Context
+ */
+ protected Command getCommand(Context context) {
+ CatalogFactory catalogFactory = CatalogFactory.getInstance();
+ String catalogName = getCatalogName();
+ Catalog catalog;
+
+ 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;
+ 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 wrapperClassName property is not null, return a Context of
+ * the type specified by wrapperClassName, instantiated using a single-arg
+ * constructor which takes the context 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 Context we are processing
+ * @return Context wrapper
+ * @throws ClassNotFoundException On failed instantiation
+ * @throws InstantiationException On failed instantiation
+ * @throws InvocationTargetException On failed instantiation
+ * @throws IllegalAccessException On failed instantiation
+ * @throws NoSuchMethodException On failed instantiation
+ */
+ 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 });
+ }
+}
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/generic/WrappingLookupCommand.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/AuthorizeAction.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/CreateAction.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/CreateAction.java?rev=421119&r1=421118&r2=421119&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/CreateAction.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/CreateAction.java Tue Jul 11 21:49:11 2006
@@ -1,80 +1,80 @@
-/*
- * $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);
- }
-}
+/*
+ * $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);
+ }
+}
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/CreateAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/CreateAction.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/ExceptionHandler.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/ExecuteAction.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/PerformForward.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/PerformInclude.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/PopulateActionForm.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/RequestNoCache.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SelectAction.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SelectForward.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SelectInput.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SelectLocale.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SelectModule.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SetContentType.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SetOriginalURI.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SetOriginalURI.java?rev=421119&r1=421118&r2=421119&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SetOriginalURI.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SetOriginalURI.java Tue Jul 11 21:49:11 2006
@@ -1,39 +1,39 @@
-/*
- * Copyright 2003,2004 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.struts.Globals;
-import org.apache.struts.chain.commands.AbstractSetOriginalURI;
-import org.apache.struts.chain.contexts.ActionContext;
-import org.apache.struts.chain.contexts.ServletActionContext;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * <p>Set the servlet path.</p>
- *
- * @version $Rev: 179995 $ $Date: 2005-06-04 07:58:46 -0700 (Sat, 04 Jun 2005)
- * $
- */
-public class SetOriginalURI extends AbstractSetOriginalURI {
- // ------------------------------------------------------- Protected Methods
- protected void setOriginalURI(ActionContext context) {
- ServletActionContext swcontext = (ServletActionContext) context;
- HttpServletRequest request = swcontext.getRequest();
-
- request.setAttribute(Globals.ORIGINAL_URI_KEY, request.getServletPath());
- }
-}
+/*
+ * Copyright 2003,2004 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.struts.Globals;
+import org.apache.struts.chain.commands.AbstractSetOriginalURI;
+import org.apache.struts.chain.contexts.ActionContext;
+import org.apache.struts.chain.contexts.ServletActionContext;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>Set the servlet path.</p>
+ *
+ * @version $Rev$ $Date: 2005-06-04 07:58:46 -0700 (Sat, 04 Jun 2005)
+ * $
+ */
+public class SetOriginalURI extends AbstractSetOriginalURI {
+ // ------------------------------------------------------- Protected Methods
+ protected void setOriginalURI(ActionContext context) {
+ ServletActionContext swcontext = (ServletActionContext) context;
+ HttpServletRequest request = swcontext.getRequest();
+
+ request.setAttribute(Globals.ORIGINAL_URI_KEY, request.getServletPath());
+ }
+}
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SetOriginalURI.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/SetOriginalURI.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/servlet/ValidateActionForm.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/util/ClassUtils.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Jul 11 21:49:11 2006
@@ -1 +1 @@
-date author id rev
+Date Author Id Revision HeadURL
Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/contexts/ActionContext.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/contexts/ActionContext.java?rev=421119&r1=421118&r2=421119&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/contexts/ActionContext.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/contexts/ActionContext.java Tue Jul 11 21:49:11 2006
@@ -1,427 +1,427 @@
-/*
- * $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.contexts;
-
-import org.apache.commons.chain.Context;
-import org.apache.struts.action.Action;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionMessages;
-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 java.util.Locale;
-import java.util.Map;
-
-/**
- * <p>An ActionContext represents a view of a commons-chain
- * <code>Context</code> which encapsulates access to request and
- * session-scoped resources and services</p>
- */
-public interface ActionContext extends Context {
- public static final String APPLICATION_SCOPE = "application";
- public static final String SESSION_SCOPE = "session";
- public static final String REQUEST_SCOPE = "request";
-
- // -------------------------------
- // General Application Support
- // -------------------------------
-
- /**
- * Signal to the instance that it will not be used any more, so that any
- * resources which should be cleaned up can be cleaned up.
- */
- void release();
-
- /**
- * <p>Return a <code>Map</code> of Application scoped values.</p>
- *
- * <p>This is implemented in analogy with the Application scope in the
- * Servlet API, but it seems reasonable to expect that any Struts
- * implementation will have an equivalent concept.</p>
- *
- * <p>The ultimate meaning of "application scope" is an implementation
- * detail left unspecified by Struts.</p>
- *
- * @return A Map of "application scope" attributes.
- */
- Map getApplicationScope();
-
- /**
- * <p>Return a <code>Map</code> of Session scoped values. A session is
- * understood as a sequence of requests made by the same user.</p>
- *
- * <p>This is implemented in analogy with the Session scope in the Servlet
- * API, but it seems reasonable to expect that any Struts implementation
- * will have an equivalent concept.</p>
- *
- * <p>The ultimate meaning of "session scope" is an implementation detail
- * left unspecified by Struts.</p>
- *
- * @return A Map of "session scope" attributes.
- */
- Map getSessionScope();
-
- /**
- * <p>Return a <code>Map</code> of request scoped values. A request is
- * understood as the fundamental motivation for any particular instance of
- * an <code>ActionContext</code>.</p>
- *
- * <p>This is implemented in analogy with the Request Context in the
- * Servlet API, but it seems reasonable to expect that any Struts
- * implementation will have an equivalent concept.</p>
- *
- * <p>The ultimate meaning of "request scope" is an implementation detail
- * left unspecified by Struts.</p>
- *
- * @return a Map of "request scope" attributes.
- */
- Map getRequestScope();
-
- /**
- * Return the Map representing the scope identified by
- * <code>scopeName</code>. Implementations should support at minimum the
- * names associated with the constants <code>APPLICATION_SCOPE</code>,
- * <code>SESSION_SCOPE</code>, and <code>REQUEST_SCOPE</code>, but are
- * permitted to support others as well.
- *
- * @param scopeName A token identifying a scope, including but not limited
- * to <code>APPLICATION_SCOPE</code>, <code>SESSION_SCOPE</code>,
- * <code>REQUEST_SCOPE</code>.
- * @return A Map of attributes for the specified scope.
- */
- Map getScope(String scopeName);
-
- /**
- * <p>Return a <code>Map</code> of parameters submitted by the user as
- * part of this request. The keys to this map will be request parameter
- * names (of type <code>String</code>), and the values will be
- * <code>String[]</code>.</p>
- *
- * <p>This is implemented in analogy with the Request parameters of the
- * Servlet API, but it seems reasonable to expect that any Struts
- * implementation will have an equivalent concept.</p>
- *
- * @return A map of the request parameter attributes
- */
- Map getParameterMap();
-
- // -------------------------------
- // General Struts properties
- // -------------------------------
-
- /**
- * <p> Set the action which has been identified to be executed as part of
- * processing this request. </p>
- *
- * @param action
- */
- void setAction(Action action);
-
- /**
- * <p> Get the action which has been identified to be executed as part of
- * processing this request. </p>
- *
- * @return The action to be executed with this request
- */
- Action getAction();
-
- /**
- * <p> Set the ActionForm instance which will carry any data submitted as
- * part of this request. </p>
- *
- * @param form The ActionForm instance to use with this request
- */
- void setActionForm(ActionForm form);
-
- /**
- * <p> Get the ActionForm instance which will carry any data submitted as
- * part of this request. </p>
- *
- * @return The ActionForm being used with this request
- */
- ActionForm getActionForm();
-
- /**
- * <p> Set the ActionConfig class contains the details for processing this
- * request. </p>
- *
- * @param config The ActionConfig class to use with this request
- */
- void setActionConfig(ActionConfig config);
-
- /**
- * <p> Get the ActionConfig which contains the details for processing this
- * request.
- *
- * @return The ActionConfig class being used with this request </p>
- */
- ActionConfig getActionConfig();
-
- /**
- * <p> Set the ForwardConfig which should be used as the basis of the view
- * segment of the overall processing. This is the primary method of
- * "communication" with the "view" sub-chain. </p>
- *
- * @param forward The ForwardConfig to use with this request
- */
- void setForwardConfig(ForwardConfig forward);
-
- /**
- * <p> Get the ForwardConfig which has been identified as the basis for
- * view-processing. </p>
- *
- * @return The ForwardConfig being used with this request
- */
- ForwardConfig getForwardConfig();
-
- /**
- * <p> Set the include path which should be processed as part of
- * processing this request. </p>
- *
- * @param include The include path to be used with this request
- */
- void setInclude(String include);
-
- /**
- * <p> Get the include path which should be processed as part of
- * processing this request. </p>
- *
- * @return The include path being used with this request
- */
- String getInclude();
-
- /**
- * <p> Set the ModuleConfig which is operative for the current request.
- * </p>
- *
- * @param config The ModuleConfig to be used with this request
- */
- void setModuleConfig(ModuleConfig config);
-
- /**
- * <p> Get the ModuleConfig which is operative for the current request.
- * </p>
- *
- * @return The MooduleConfig being used with this request
- */
- ModuleConfig getModuleConfig();
-
- /**
- * <p> Is the ActionForm for this context valid? This method <em>does
- * not</em> actually perform form validation. It is simply a holder
- * property where processes which perform validation can store the results
- * of the validation for other processes' benefit. </p>
- *
- * @return <code>Boolean.TRUE</code> if the form passed validation;
- * <code>Boolean.FALSE</code> if the form failed validation; null
- * if the form has not yet been validated
- */
- Boolean getFormValid();
-
- /**
- * <p> Store the result of the validation of the Context's ActionForm.
- * </p>
- *
- * @param valid Whether the ActionForm for this request passes validation
- */
- void setFormValid(Boolean valid);
-
- /**
- * <p> Retrieve an exception which may have been caught by some code using
- * this ActionContext, usually by an exception handler. </p>
- *
- * @return Any exception that may have been caught by this ActionContext
- */
- Exception getException();
-
- /**
- * <p> Store an exception in this context for use by other handling code.
- * </p>
- *
- * @param e An exception to be stored for handling by another member
- */
- void setException(Exception e);
-
- // -------------------------------
- // ActionMessage Processing
- // -------------------------------
-
- /**
- * <p> Append the given messages keys to an internal cache, creating the
- * cache if one is not already present. </p>
- *
- * @param messages New ActionMessages to cache
- */
- void addMessages(ActionMessages messages);
-
- /**
- * <p> Append the given errors keys to an internal cache, creating the
- * cache if one is not already present. </p>
- *
- * @param errors New ActionMessages to cache as errors
- */
- void addErrors(ActionMessages errors);
-
- /**
- * <p> Retrieve error messages from an internal cache, creating an empty
- * cache if one is not already present. </p>
- *
- * @return The ActionMessage cache for errors
- */
- ActionMessages getErrors();
-
- /**
- * <p> Retrieve messages from an internal cache, creating an empty cache
- * if one is not already present. </p>
- *
- * @return The ActionMessage cache for errors
- */
- ActionMessages getMessages();
-
- /**
- * <p> Save the given error messages to the internal cache, clearing any
- * previous messages in the cache. </p> <p> If the parameter is null or
- * empty, the internal cache is removed. </p>
- *
- * @param errors ActionMesssages to cache as errors
- */
- void saveErrors(ActionMessages errors);
-
- /**
- * <p> Save the given messages to the internal cache, clearing any
- * previous messages in the cache. </p> <p> If the parameter is null or
- * empty, the internal cache is removed. </p>
- *
- * @param messages ActionMesssages to cache
- */
- void saveMessages(ActionMessages messages);
-
- /**
- * <p> Save the given messages to the internal cache, clearing any
- * previous messages in the cache, but only for the specified scope. </p>
- * <p> If the parameter is null or empty, the internal cache is removed.
- * </p>
- *
- * @param scope The scope for the internal cache
- * @param messages ActionMesssages to cache
- */
- void saveMessages(String scope, ActionMessages messages);
-
- // -------------------------------
- // Token Processing
- // -------------------------------
-
- /**
- * <p>Generate a new transaction token, to be used for enforcing a single
- * request for a particular transaction.</p>
- */
- String generateToken();
-
- /**
- * <p> Indicate whether a transaction token for this context is valid.
- * </p> <p> A typical implementation will place a transaction token in the
- * session" scope Map and a matching value in the "parameter" Map. If the
- * "session" token does not match the "parameter" attribute, or the
- * session token is missing, then the transactional token is deemed
- * invalid. </p>
- */
- boolean isTokenValid();
-
- /**
- * <p> Indicate whether a transaction token is stored in the "session"
- * scope for this context, optionally clearing the token, so that the next
- * check would return false. </p>
- *
- * @param reset On true, clear the transactional token
- */
- boolean isTokenValid(boolean reset);
-
- /**
- * <p> Clear any transactional token stored in the "session" scope for
- * this context, so that the next check would return false. </p>
- */
- void resetToken();
-
- /**
- * <p> Save a new transaction token in the "session" scope for this
- * context, creating new resources, if needed. </p>
- */
- void saveToken();
-
- // -------------------------------
- // Cancel Processing
- // -------------------------------
-
- /**
- * <p> Indicate if the "cancel event" state is set for for this context,
- * </p>
- *
- * @see ActionContextBase.CANCEL_KEY
- */
- Boolean getCancelled();
-
- /**
- * <p> Set the "cancel event" state for this context. </p> <p>
- *
- * @param cancelled On true, set the cancel event state to true. On false,
- * set the cancel event state to false.
- * @see ActionContextBase.CANCEL_KEY
- */
- void setCancelled(Boolean cancelled);
-
- // -------------------------------
- // MessageResources Processing
- // -------------------------------
-
- /**
- * <p>Return the default message resources for the current module.</p>
- */
- MessageResources getMessageResources();
-
- /**
- * <p>Set the default message resources for the current module.</p>
- */
- void setMessageResources(MessageResources resources);
-
- /**
- * <p>Return the specified message resources for the current module.</p>
- *
- * @param key The key specified in the <code><message-resources></code>
- * element for the requested bundle
- */
- MessageResources getMessageResources(String key);
-
- // -------------------------------
- // Locale Processing
- // -------------------------------
-
- /**
- * <p>Return the user's currently selected Locale.</p>
- */
- Locale getLocale();
-
- /**
- * <p>Set the user's currently selected <code>Locale</code>.</p>
- *
- * @param locale The user's selected Locale to be set, or null to select
- * the server's default Locale
- */
- void setLocale(Locale locale);
-}
+/*
+ * $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.contexts;
+
+import org.apache.commons.chain.Context;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMessages;
+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 java.util.Locale;
+import java.util.Map;
+
+/**
+ * <p>An ActionContext represents a view of a commons-chain
+ * <code>Context</code> which encapsulates access to request and
+ * session-scoped resources and services</p>
+ */
+public interface ActionContext extends Context {
+ public static final String APPLICATION_SCOPE = "application";
+ public static final String SESSION_SCOPE = "session";
+ public static final String REQUEST_SCOPE = "request";
+
+ // -------------------------------
+ // General Application Support
+ // -------------------------------
+
+ /**
+ * Signal to the instance that it will not be used any more, so that any
+ * resources which should be cleaned up can be cleaned up.
+ */
+ void release();
+
+ /**
+ * <p>Return a <code>Map</code> of Application scoped values.</p>
+ *
+ * <p>This is implemented in analogy with the Application scope in the
+ * Servlet API, but it seems reasonable to expect that any Struts
+ * implementation will have an equivalent concept.</p>
+ *
+ * <p>The ultimate meaning of "application scope" is an implementation
+ * detail left unspecified by Struts.</p>
+ *
+ * @return A Map of "application scope" attributes.
+ */
+ Map getApplicationScope();
+
+ /**
+ * <p>Return a <code>Map</code> of Session scoped values. A session is
+ * understood as a sequence of requests made by the same user.</p>
+ *
+ * <p>This is implemented in analogy with the Session scope in the Servlet
+ * API, but it seems reasonable to expect that any Struts implementation
+ * will have an equivalent concept.</p>
+ *
+ * <p>The ultimate meaning of "session scope" is an implementation detail
+ * left unspecified by Struts.</p>
+ *
+ * @return A Map of "session scope" attributes.
+ */
+ Map getSessionScope();
+
+ /**
+ * <p>Return a <code>Map</code> of request scoped values. A request is
+ * understood as the fundamental motivation for any particular instance of
+ * an <code>ActionContext</code>.</p>
+ *
+ * <p>This is implemented in analogy with the Request Context in the
+ * Servlet API, but it seems reasonable to expect that any Struts
+ * implementation will have an equivalent concept.</p>
+ *
+ * <p>The ultimate meaning of "request scope" is an implementation detail
+ * left unspecified by Struts.</p>
+ *
+ * @return a Map of "request scope" attributes.
+ */
+ Map getRequestScope();
+
+ /**
+ * Return the Map representing the scope identified by
+ * <code>scopeName</code>. Implementations should support at minimum the
+ * names associated with the constants <code>APPLICATION_SCOPE</code>,
+ * <code>SESSION_SCOPE</code>, and <code>REQUEST_SCOPE</code>, but are
+ * permitted to support others as well.
+ *
+ * @param scopeName A token identifying a scope, including but not limited
+ * to <code>APPLICATION_SCOPE</code>, <code>SESSION_SCOPE</code>,
+ * <code>REQUEST_SCOPE</code>.
+ * @return A Map of attributes for the specified scope.
+ */
+ Map getScope(String scopeName);
+
+ /**
+ * <p>Return a <code>Map</code> of parameters submitted by the user as
+ * part of this request. The keys to this map will be request parameter
+ * names (of type <code>String</code>), and the values will be
+ * <code>String[]</code>.</p>
+ *
+ * <p>This is implemented in analogy with the Request parameters of the
+ * Servlet API, but it seems reasonable to expect that any Struts
+ * implementation will have an equivalent concept.</p>
+ *
+ * @return A map of the request parameter attributes
+ */
+ Map getParameterMap();
+
+ // -------------------------------
+ // General Struts properties
+ // -------------------------------
+
+ /**
+ * <p> Set the action which has been identified to be executed as part of
+ * processing this request. </p>
+ *
+ * @param action
+ */
+ void setAction(Action action);
+
+ /**
+ * <p> Get the action which has been identified to be executed as part of
+ * processing this request. </p>
+ *
+ * @return The action to be executed with this request
+ */
+ Action getAction();
+
+ /**
+ * <p> Set the ActionForm instance which will carry any data submitted as
+ * part of this request. </p>
+ *
+ * @param form The ActionForm instance to use with this request
+ */
+ void setActionForm(ActionForm form);
+
+ /**
+ * <p> Get the ActionForm instance which will carry any data submitted as
+ * part of this request. </p>
+ *
+ * @return The ActionForm being used with this request
+ */
+ ActionForm getActionForm();
+
+ /**
+ * <p> Set the ActionConfig class contains the details for processing this
+ * request. </p>
+ *
+ * @param config The ActionConfig class to use with this request
+ */
+ void setActionConfig(ActionConfig config);
+
+ /**
+ * <p> Get the ActionConfig which contains the details for processing this
+ * request.
+ *
+ * @return The ActionConfig class being used with this request </p>
+ */
+ ActionConfig getActionConfig();
+
+ /**
+ * <p> Set the ForwardConfig which should be used as the basis of the view
+ * segment of the overall processing. This is the primary method of
+ * "communication" with the "view" sub-chain. </p>
+ *
+ * @param forward The ForwardConfig to use with this request
+ */
+ void setForwardConfig(ForwardConfig forward);
+
+ /**
+ * <p> Get the ForwardConfig which has been identified as the basis for
+ * view-processing. </p>
+ *
+ * @return The ForwardConfig being used with this request
+ */
+ ForwardConfig getForwardConfig();
+
+ /**
+ * <p> Set the include path which should be processed as part of
+ * processing this request. </p>
+ *
+ * @param include The include path to be used with this request
+ */
+ void setInclude(String include);
+
+ /**
+ * <p> Get the include path which should be processed as part of
+ * processing this request. </p>
+ *
+ * @return The include path being used with this request
+ */
+ String getInclude();
+
+ /**
+ * <p> Set the ModuleConfig which is operative for the current request.
+ * </p>
+ *
+ * @param config The ModuleConfig to be used with this request
+ */
+ void setModuleConfig(ModuleConfig config);
+
+ /**
+ * <p> Get the ModuleConfig which is operative for the current request.
+ * </p>
+ *
+ * @return The MooduleConfig being used with this request
+ */
+ ModuleConfig getModuleConfig();
+
+ /**
+ * <p> Is the ActionForm for this context valid? This method <em>does
+ * not</em> actually perform form validation. It is simply a holder
+ * property where processes which perform validation can store the results
+ * of the validation for other processes' benefit. </p>
+ *
+ * @return <code>Boolean.TRUE</code> if the form passed validation;
+ * <code>Boolean.FALSE</code> if the form failed validation; null
+ * if the form has not yet been validated
+ */
+ Boolean getFormValid();
+
+ /**
+ * <p> Store the result of the validation of the Context's ActionForm.
+ * </p>
+ *
+ * @param valid Whether the ActionForm for this request passes validation
+ */
+ void setFormValid(Boolean valid);
+
+ /**
+ * <p> Retrieve an exception which may have been caught by some code using
+ * this ActionContext, usually by an exception handler. </p>
+ *
+ * @return Any exception that may have been caught by this ActionContext
+ */
+ Exception getException();
+
+ /**
+ * <p> Store an exception in this context for use by other handling code.
+ * </p>
+ *
+ * @param e An exception to be stored for handling by another member
+ */
+ void setException(Exception e);
+
+ // -------------------------------
+ // ActionMessage Processing
+ // -------------------------------
+
+ /**
+ * <p> Append the given messages keys to an internal cache, creating the
+ * cache if one is not already present. </p>
+ *
+ * @param messages New ActionMessages to cache
+ */
+ void addMessages(ActionMessages messages);
+
+ /**
+ * <p> Append the given errors keys to an internal cache, creating the
+ * cache if one is not already present. </p>
+ *
+ * @param errors New ActionMessages to cache as errors
+ */
+ void addErrors(ActionMessages errors);
+
+ /**
+ * <p> Retrieve error messages from an internal cache, creating an empty
+ * cache if one is not already present. </p>
+ *
+ * @return The ActionMessage cache for errors
+ */
+ ActionMessages getErrors();
+
+ /**
+ * <p> Retrieve messages from an internal cache, creating an empty cache
+ * if one is not already present. </p>
+ *
+ * @return The ActionMessage cache for errors
+ */
+ ActionMessages getMessages();
+
+ /**
+ * <p> Save the given error messages to the internal cache, clearing any
+ * previous messages in the cache. </p> <p> If the parameter is null or
+ * empty, the internal cache is removed. </p>
+ *
+ * @param errors ActionMesssages to cache as errors
+ */
+ void saveErrors(ActionMessages errors);
+
+ /**
+ * <p> Save the given messages to the internal cache, clearing any
+ * previous messages in the cache. </p> <p> If the parameter is null or
+ * empty, the internal cache is removed. </p>
+ *
+ * @param messages ActionMesssages to cache
+ */
+ void saveMessages(ActionMessages messages);
+
+ /**
+ * <p> Save the given messages to the internal cache, clearing any
+ * previous messages in the cache, but only for the specified scope. </p>
+ * <p> If the parameter is null or empty, the internal cache is removed.
+ * </p>
+ *
+ * @param scope The scope for the internal cache
+ * @param messages ActionMesssages to cache
+ */
+ void saveMessages(String scope, ActionMessages messages);
+
+ // -------------------------------
+ // Token Processing
+ // -------------------------------
+
+ /**
+ * <p>Generate a new transaction token, to be used for enforcing a single
+ * request for a particular transaction.</p>
+ */
+ String generateToken();
+
+ /**
+ * <p> Indicate whether a transaction token for this context is valid.
+ * </p> <p> A typical implementation will place a transaction token in the
+ * session" scope Map and a matching value in the "parameter" Map. If the
+ * "session" token does not match the "parameter" attribute, or the
+ * session token is missing, then the transactional token is deemed
+ * invalid. </p>
+ */
+ boolean isTokenValid();
+
+ /**
+ * <p> Indicate whether a transaction token is stored in the "session"
+ * scope for this context, optionally clearing the token, so that the next
+ * check would return false. </p>
+ *
+ * @param reset On true, clear the transactional token
+ */
+ boolean isTokenValid(boolean reset);
+
+ /**
+ * <p> Clear any transactional token stored in the "session" scope for
+ * this context, so that the next check would return false. </p>
+ */
+ void resetToken();
+
+ /**
+ * <p> Save a new transaction token in the "session" scope for this
+ * context, creating new resources, if needed. </p>
+ */
+ void saveToken();
+
+ // -------------------------------
+ // Cancel Processing
+ // -------------------------------
+
+ /**
+ * <p> Indicate if the "cancel event" state is set for for this context,
+ * </p>
+ *
+ * @see ActionContextBase.CANCEL_KEY
+ */
+ Boolean getCancelled();
+
+ /**
+ * <p> Set the "cancel event" state for this context. </p> <p>
+ *
+ * @param cancelled On true, set the cancel event state to true. On false,
+ * set the cancel event state to false.
+ * @see ActionContextBase.CANCEL_KEY
+ */
+ void setCancelled(Boolean cancelled);
+
+ // -------------------------------
+ // MessageResources Processing
+ // -------------------------------
+
+ /**
+ * <p>Return the default message resources for the current module.</p>
+ */
+ MessageResources getMessageResources();
+
+ /**
+ * <p>Set the default message resources for the current module.</p>
+ */
+ void setMessageResources(MessageResources resources);
+
+ /**
+ * <p>Return the specified message resources for the current module.</p>
+ *
+ * @param key The key specified in the <code><message-resources></code>
+ * element for the requested bundle
+ */
+ MessageResources getMessageResources(String key);
+
+ // -------------------------------
+ // Locale Processing
+ // -------------------------------
+
+ /**
+ * <p>Return the user's currently selected Locale.</p>
+ */
+ Locale getLocale();
+
+ /**
+ * <p>Set the user's currently selected <code>Locale</code>.</p>
+ *
+ * @param locale The user's selected Locale to be set, or null to select
+ * the server's default Locale
+ */
+ void setLocale(Locale locale);
+}
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/contexts/ActionContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/contexts/ActionContext.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL