You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ku...@apache.org on 2024/10/17 07:01:44 UTC
(struts) branch kusal-depr-apis-7 updated (e4d2877b6 -> a6c4b5220)
This is an automated email from the ASF dual-hosted git repository.
kusal pushed a change to branch kusal-depr-apis-7
in repository https://gitbox.apache.org/repos/asf/struts.git
discard e4d2877b6 WW-3714 Deprecate and migrate assorted Interceptors
new a6c4b5220 WW-3714 Deprecate and migrate assorted Interceptors
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (e4d2877b6)
\
N -- N -- N refs/heads/kusal-depr-apis-7 (a6c4b5220)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../xwork2/interceptor/AliasInterceptor.java | 11 ++++++----
.../xwork2/interceptor/ChainingInterceptor.java | 16 ++++++++++----
.../interceptor/ConversionErrorInterceptor.java | 7 ++++--
.../interceptor/DefaultWorkflowInterceptor.java | 5 ++++-
.../interceptor/ExceptionMappingInterceptor.java | 5 ++++-
.../xwork2/interceptor/LoggingInterceptor.java | 3 +++
.../xwork2/interceptor/ModelDrivenInterceptor.java | 5 ++++-
.../interceptor/ParameterRemoverInterceptor.java | 3 +++
.../xwork2/interceptor/PrepareInterceptor.java | 5 +++--
.../interceptor/ScopedModelDrivenInterceptor.java | 25 ++++++++++++----------
.../interceptor/StaticParametersInterceptor.java | 5 ++++-
11 files changed, 63 insertions(+), 27 deletions(-)
(struts) 01/01: WW-3714 Deprecate and migrate assorted Interceptors
Posted by ku...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kusal pushed a commit to branch kusal-depr-apis-7
in repository https://gitbox.apache.org/repos/asf/struts.git
commit a6c4b522086e6e4e5d8b3e7ececa5ff1ad3168ea
Author: Kusal Kithul-Godage <gi...@kusal.io>
AuthorDate: Thu Oct 17 17:53:30 2024 +1100
WW-3714 Deprecate and migrate assorted Interceptors
---
.../xwork2/conversion/impl/XWorkConverter.java | 19 ++++++--
.../xwork2/interceptor/AliasInterceptor.java | 11 +++--
.../xwork2/interceptor/ChainingInterceptor.java | 16 +++++--
.../interceptor/ConversionErrorInterceptor.java | 7 ++-
.../interceptor/DefaultWorkflowInterceptor.java | 5 ++-
.../interceptor/ExceptionMappingInterceptor.java | 5 ++-
.../xwork2/interceptor/LoggingInterceptor.java | 3 ++
.../xwork2/interceptor/ModelDrivenInterceptor.java | 5 ++-
.../interceptor/ParameterRemoverInterceptor.java | 3 ++
.../interceptor/PrefixMethodInvocationUtil.java | 51 ++++++++++++----------
.../xwork2/interceptor/PrepareInterceptor.java | 5 ++-
.../interceptor/ScopedModelDrivenInterceptor.java | 25 ++++++-----
.../interceptor/StaticParametersInterceptor.java | 5 ++-
.../opensymphony/xwork2/util/TextParseUtil.java | 3 ++
.../xwork2/util/ValueStackFactory.java | 7 ++-
.../struts2}/interceptor/AliasInterceptor.java | 20 +++++----
.../struts2}/interceptor/ChainingInterceptor.java | 25 ++++++-----
.../interceptor/ConversionErrorInterceptor.java | 21 ++++-----
.../interceptor/DefaultWorkflowInterceptor.java | 29 ++++++------
.../interceptor/ExceptionMappingInterceptor.java | 9 ++--
.../struts2}/interceptor/LoggingInterceptor.java | 4 +-
.../interceptor/ModelDrivenInterceptor.java | 9 ++--
.../interceptor/ParameterRemoverInterceptor.java | 8 ++--
.../struts2}/interceptor/PrepareInterceptor.java | 11 +++--
.../interceptor/ScopedModelDrivenInterceptor.java | 35 +++++++--------
.../interceptor/StaticParametersInterceptor.java | 14 +++---
26 files changed, 214 insertions(+), 141 deletions(-)
diff --git a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
index 3cda3e34d..5d16d0e4d 100644
--- a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
+++ b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
@@ -18,12 +18,21 @@
*/
package com.opensymphony.xwork2.conversion.impl;
-import com.opensymphony.xwork2.*;
-import com.opensymphony.xwork2.conversion.*;
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
+import com.opensymphony.xwork2.LocalizedTextProvider;
+import com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor;
+import com.opensymphony.xwork2.conversion.ConversionFileProcessor;
+import com.opensymphony.xwork2.conversion.TypeConverter;
+import com.opensymphony.xwork2.conversion.TypeConverterHolder;
import com.opensymphony.xwork2.conversion.annotations.Conversion;
import com.opensymphony.xwork2.conversion.annotations.TypeConversion;
import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.*;
+import com.opensymphony.xwork2.util.AnnotationUtils;
+import com.opensymphony.xwork2.util.ClassLoaderUtil;
+import com.opensymphony.xwork2.util.CompoundRoot;
+import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
@@ -220,6 +229,10 @@ public class XWorkConverter extends DefaultTypeConverter {
return message;
}
+ public static String getConversionErrorMessage(String propertyName, Class toClass, org.apache.struts2.util.ValueStack stack) {
+ return getConversionErrorMessage(propertyName, toClass, ValueStack.adapt(stack));
+ }
+
private static String removeAllIndexesInPropertyName(String propertyName) {
return propertyName.replaceAll(MESSAGE_INDEX_PATTERN, PERIOD);
}
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
index 9edafe3fc..d874310f8 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
@@ -20,21 +20,21 @@ package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.security.AcceptedPatternsChecker;
import com.opensymphony.xwork2.security.ExcludedPatternsChecker;
import com.opensymphony.xwork2.util.ClearableValueStack;
import com.opensymphony.xwork2.util.Evaluated;
-import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.struts2.StrutsConstants;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.Parameter;
-import org.apache.struts2.StrutsConstants;
import java.util.Map;
@@ -90,7 +90,10 @@ import java.util.Map;
* </pre>
*
* @author Matthew Payne
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.AliasInterceptor} instead.
*/
+@Deprecated
public class AliasInterceptor extends AbstractInterceptor {
private static final Logger LOG = LogManager.getLogger(AliasInterceptor.class);
@@ -108,7 +111,7 @@ public class AliasInterceptor extends AbstractInterceptor {
@Inject(StrutsConstants.STRUTS_DEVMODE)
public void setDevMode(String mode) {
this.devMode = Boolean.parseBoolean(mode);
- }
+ }
@Inject
public void setValueStackFactory(ValueStackFactory valueStackFactory) {
@@ -225,7 +228,7 @@ public class AliasInterceptor extends AbstractInterceptor {
LOG.debug("invalid alias expression: {}", aliasesKey);
}
}
-
+
return invocation.invoke();
}
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java
index 31b0075a3..f068fc1ac 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java
@@ -23,16 +23,21 @@ import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.Unchainable;
import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.ProxyUtil;
import com.opensymphony.xwork2.util.CompoundRoot;
+import com.opensymphony.xwork2.util.ProxyUtil;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsConstants;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
/**
@@ -113,7 +118,10 @@ import java.util.*;
* @author mrdon
* @author tm_jee ( tm_jee(at)yahoo.co.uk )
* @see com.opensymphony.xwork2.ActionChainResult
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ChainingInterceptor} instead.
*/
+@Deprecated
public class ChainingInterceptor extends AbstractInterceptor {
private static final Logger LOG = LogManager.getLogger(ChainingInterceptor.class);
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
index ee8e39281..54d4b6634 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
@@ -41,13 +41,13 @@ import java.util.Map;
* display the original string ("abc") again rather than the int value (likely 0, which would make very little sense to
* the user).
* </p>
- *
+ *
* <p>
* <b>Note:</b> Since 2.5.2, this interceptor extends {@link MethodFilterInterceptor}, therefore being
* able to deal with excludeMethods / includeMethods parameters. See [Workflow Interceptor]
* (class {@link DefaultWorkflowInterceptor}) for documentation and examples on how to use this feature.
* </p>
- *
+ *
* <!-- END SNIPPET: description -->
*
* <p><u>Interceptor parameters:</u></p>
@@ -84,7 +84,10 @@ import java.util.Map;
* </pre>
*
* @author Jason Carreira
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ConversionErrorInterceptor} instead.
*/
+@Deprecated
public class ConversionErrorInterceptor extends MethodFilterInterceptor {
public static final String ORIGINAL_PROPERTY_OVERRIDE = "original.property.override";
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
index d2cbd0b78..913638913 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
@@ -29,7 +29,7 @@ import org.apache.logging.log4j.Logger;
/**
* <!-- START SNIPPET: description -->
* <p>
- * An interceptor that makes sure there are not validation, conversion or action errors before allowing the interceptor chain to continue.
+ * An interceptor that makes sure there are not validation, conversion or action errors before allowing the interceptor chain to continue.
* If a single FieldError or ActionError (including the ones replicated by the Message Store Interceptor in a redirection) is found, the INPUT result will be triggered.
* <b>This interceptor does not perform any validation</b>.
* </p>
@@ -129,7 +129,10 @@ import org.apache.logging.log4j.Logger;
* @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
* @author Philip Luppens
* @author tm_jee
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.DefaultWorkflowInterceptor} instead.
*/
+@Deprecated
public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
private static final long serialVersionUID = 7563014655616490865L;
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
index e60550ca6..3bb70bcb8 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
@@ -20,8 +20,8 @@ package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.config.entities.ExceptionMappingConfig;
-import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.struts2.dispatcher.HttpParameters;
import java.util.List;
@@ -153,7 +153,10 @@ import java.util.Map;
*
* @author Matthew E. Porter (matthew dot porter at metissian dot com)
* @author Claus Ibsen
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ExceptionMappingInterceptor} instead.
*/
+@Deprecated
public class ExceptionMappingInterceptor extends AbstractInterceptor {
private static final Logger LOG = LogManager.getLogger(ExceptionMappingInterceptor.class);
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java
index 6ba498b3c..3f012288c 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java
@@ -59,7 +59,10 @@ import org.apache.logging.log4j.Logger;
* </pre>
*
* @author Jason Carreira
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.LoggingInterceptor} instead.
*/
+@Deprecated
public class LoggingInterceptor extends AbstractInterceptor {
private static final Logger LOG = LogManager.getLogger(LoggingInterceptor.class);
private static final String FINISH_MESSAGE = "Finishing execution stack for action ";
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java
index fa90a315c..a22075d11 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java
@@ -71,10 +71,13 @@ import com.opensymphony.xwork2.util.ValueStack;
* </action>
* <!-- END SNIPPET: example -->
* </pre>
- *
+ *
* @author tm_jee
* @version $Date$ $Id$
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ModelDrivenInterceptor} instead.
*/
+@Deprecated
public class ModelDrivenInterceptor extends AbstractInterceptor {
protected boolean refreshModelBeforeResult = false;
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptor.java
index c0f83765c..f33ebf6e2 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptor.java
@@ -66,7 +66,10 @@ import java.util.Set;
* ...
* </action>
* </pre>
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ParameterRemoverInterceptor} instead.
*/
+@Deprecated
public class ParameterRemoverInterceptor extends AbstractInterceptor {
private static final Logger LOG = LogManager.getLogger(ParameterRemoverInterceptor.class);
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrefixMethodInvocationUtil.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/PrefixMethodInvocationUtil.java
index 040080824..0ac840c7a 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrefixMethodInvocationUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/PrefixMethodInvocationUtil.java
@@ -19,8 +19,8 @@
package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
-import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -28,7 +28,7 @@ import java.lang.reflect.Method;
/**
* <p>
* A utility class for invoking prefixed methods in action class.
- *
+ *
* Interceptors that made use of this class are:
* </p>
* <ul>
@@ -37,7 +37,7 @@ import java.lang.reflect.Method;
* </ul>
* *
* <!-- START SNIPPET: javadocDefaultWorkflowInterceptor -->
- *
+ *
* <b>In DefaultWorkflowInterceptor</b>
* <p>applies only when action implements {@link com.opensymphony.xwork2.Validateable}</p>
* <ol>
@@ -45,12 +45,12 @@ import java.lang.reflect.Method;
* <li>else if the action class have validateDo{MethodName}(), it will be invoked</li>
* <li>no matter if 1] or 2] is performed, if alwaysInvokeValidate property of the interceptor is "true" (which is by default "true"), validate() will be invoked.</li>
* </ol>
- *
+ *
* <!-- END SNIPPET: javadocDefaultWorkflowInterceptor -->
- *
- *
+ *
+ *
* <!-- START SNIPPET: javadocPrepareInterceptor -->
- *
+ *
* <b>In PrepareInterceptor</b>
* <p>Applies only when action implements Preparable</p>
* <ol>
@@ -58,14 +58,14 @@ import java.lang.reflect.Method;
* <li>else if the action class have prepareDo(MethodName()}(), it will be invoked</li>
* <li>no matter if 1] or 2] is performed, if alwaysinvokePrepare property of the interceptor is "true" (which is by default "true"), prepare() will be invoked.</li>
* </ol>
- *
+ *
* <!-- END SNIPPET: javadocPrepareInterceptor -->
- *
+ *
* @author Philip Luppens
* @author tm_jee
*/
public class PrefixMethodInvocationUtil {
-
+
private static final Logger LOG = LogManager.getLogger(PrefixMethodInvocationUtil.class);
private static final String DEFAULT_INVOCATION_METHODNAME = "execute";
@@ -76,7 +76,7 @@ public class PrefixMethodInvocationUtil {
* <p>
* This method will prefix <code>actionInvocation</code>'s <code>ActionProxy</code>'s
* <code>method</code> with <code>prefixes</code> before invoking the prefixed method.
- * Order of the <code>prefixes</code> is important, as this method will return once
+ * Order of the <code>prefixes</code> is important, as this method will return once
* a prefixed method is found in the action class.
* </p>
*
@@ -89,7 +89,7 @@ public class PrefixMethodInvocationUtil {
* </pre>
*
* <p>
- * Assuming <code>actionInvocation.getProxy(),getMethod()</code> returns "submit",
+ * Assuming <code>actionInvocation.getProxy(),getMethod()</code> returns "submit",
* the order of invocation would be as follows:-
* </p>
*
@@ -99,12 +99,12 @@ public class PrefixMethodInvocationUtil {
* </ol>
*
* <p>
- * If <code>prepareSubmit()</code> exists, it will be invoked and this method
- * will return, <code>prepareDoSubmit()</code> will NOT be invoked.
+ * If <code>prepareSubmit()</code> exists, it will be invoked and this method
+ * will return, <code>prepareDoSubmit()</code> will NOT be invoked.
* </p>
*
* <p>
- * On the other hand, if <code>prepareDoSubmit()</code> does not exists, and
+ * On the other hand, if <code>prepareDoSubmit()</code> does not exists, and
* <code>prepareDoSubmit()</code> exists, it will be invoked.
* </p>
*
@@ -119,29 +119,32 @@ public class PrefixMethodInvocationUtil {
*/
public static void invokePrefixMethod(ActionInvocation actionInvocation, String[] prefixes) throws InvocationTargetException, IllegalAccessException {
Object action = actionInvocation.getAction();
-
+
String methodName = actionInvocation.getProxy().getMethod();
-
+
if (methodName == null) {
- // if null returns (possible according to the docs), use the default execute
+ // if null returns (possible according to the docs), use the default execute
methodName = DEFAULT_INVOCATION_METHODNAME;
}
-
+
Method method = getPrefixedMethod(prefixes, methodName, action);
if (method != null) {
method.invoke(action, new Object[0]);
}
}
-
-
+
+ public static void invokePrefixMethod(org.apache.struts2.ActionInvocation actionInvocation, String[] prefixes) throws InvocationTargetException, IllegalAccessException {
+ invokePrefixMethod(ActionInvocation.adapt(actionInvocation), prefixes);
+ }
+
/**
- * This method returns a {@link Method} in <code>action</code>. The method
+ * This method returns a {@link Method} in <code>action</code>. The method
* returned is found by searching for method in <code>action</code> whose method name
* is equals to the result of appending each <code>prefixes</code>
* to <code>methodName</code>. Only the first method found will be returned, hence
* the order of <code>prefixes</code> is important. If none is found this method
* will return null.
- *
+ *
* @param prefixes the prefixes to prefix the <code>methodName</code>
* @param methodName the method name to be prefixed with <code>prefixes</code>
* @param action the action class of which the prefixed method is to be search for.
@@ -162,7 +165,7 @@ public class PrefixMethodInvocationUtil {
}
return null;
}
-
+
/**
* <p>
* This method capitalized the first character of <code>methodName</code>.
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java
index 4516d760c..f2a6aef37 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java
@@ -20,8 +20,6 @@ package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Preparable;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
import java.lang.reflect.InvocationTargetException;
@@ -98,7 +96,10 @@ import java.lang.reflect.InvocationTargetException;
* @author Philip Luppens
* @author tm_jee
* @see com.opensymphony.xwork2.Preparable
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.PrepareInterceptor} instead.
*/
+@Deprecated
public class PrepareInterceptor extends MethodFilterInterceptor {
private static final long serialVersionUID = -5216969014510719786L;
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java
index 22da179d4..0837d0486 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java
@@ -35,7 +35,7 @@ import java.util.Map;
*
* <p>This interceptor only activates on actions that implement the {@link ScopedModelDriven} interface. If
* detected, it will retrieve the model class from the configured scope, then provide it to the Action.</p>
- *
+ *
* <!-- END SNIPPET: description -->
*
* <p><u>Interceptor parameters:</u></p>
@@ -45,7 +45,7 @@ import java.util.Map;
* <ul>
*
* <li>className - The model class name. Defaults to the class name of the object returned by the getModel() method.</li>
- *
+ *
* <li>name - The key to use when storing or retrieving the instance in a scope. Defaults to the model
* class name.</li>
*
@@ -66,42 +66,45 @@ import java.util.Map;
*
* <pre>
* <!-- START SNIPPET: example -->
- *
+ *
* <-- Basic usage -->
* <interceptor name="scopedModelDriven" class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor" />
- *
+ *
* <-- Using all available parameters -->
* <interceptor name="gangsterForm" class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor">
* <param name="scope">session</param>
* <param name="name">gangsterForm</param>
* <param name="className">com.opensymphony.example.GangsterForm</param>
* </interceptor>
- *
+ *
* <!-- END SNIPPET: example -->
* </pre>
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.ScopedModelDrivenInterceptor} instead.
*/
+@Deprecated
public class ScopedModelDrivenInterceptor extends AbstractInterceptor {
private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
-
+
private static final String GET_MODEL = "getModel";
private String scope;
private String name;
private String className;
private ObjectFactory objectFactory;
-
+
@Inject
public void setObjectFactory(ObjectFactory factory) {
this.objectFactory = factory;
}
-
+
protected Object resolveModel(ObjectFactory factory, ActionContext actionContext, String modelClassName, String modelScope, String modelName) throws Exception {
Object model;
Map<String, Object> scopeMap = actionContext.getContextMap();
if ("session".equals(modelScope)) {
scopeMap = actionContext.getSession();
}
-
+
model = scopeMap.get(modelName);
if (model == null) {
model = factory.buildBean(modelClassName, null);
@@ -119,7 +122,7 @@ public class ScopedModelDrivenInterceptor extends AbstractInterceptor {
if (modelDriven.getModel() == null) {
ActionContext ctx = ActionContext.getContext();
ActionConfig config = invocation.getProxy().getConfig();
-
+
String cName = className;
if (cName == null) {
try {
@@ -161,5 +164,5 @@ public class ScopedModelDrivenInterceptor extends AbstractInterceptor {
*/
public void setScope(String scope) {
this.scope = scope;
- }
+ }
}
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
index 9d32a8a18..64da2c323 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
@@ -20,11 +20,11 @@ package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.config.entities.Parameterizable;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ClearableValueStack;
-import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
@@ -84,7 +84,10 @@ import java.util.Map;
* </pre>
*
* @author Patrick Lightbody
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.interceptor.StaticParametersInterceptor} instead.
*/
+@Deprecated
public class StaticParametersInterceptor extends AbstractInterceptor {
private boolean parse;
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java
index 2a2cad1bf..9220159bf 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java
@@ -51,6 +51,9 @@ public class TextParseUtil {
return translateVariables(new char[]{'$', '%'}, expression, stack, String.class, null).toString();
}
+ public static String translateVariables(String expression, org.apache.struts2.util.ValueStack stack) {
+ return translateVariables(expression, ValueStack.adapt(stack));
+ }
/**
* Function similarly as {@link #translateVariables(char, String, ValueStack)}
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/ValueStackFactory.java b/core/src/main/java/com/opensymphony/xwork2/util/ValueStackFactory.java
index 788c90453..70d072851 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/ValueStackFactory.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/ValueStackFactory.java
@@ -29,7 +29,7 @@ public interface ValueStackFactory {
* @return a new {@link com.opensymphony.xwork2.util.ValueStack}.
*/
ValueStack createValueStack();
-
+
/**
* Get a new instance of {@link com.opensymphony.xwork2.util.ValueStack}
*
@@ -37,5 +37,8 @@ public interface ValueStackFactory {
* @return a new {@link com.opensymphony.xwork2.util.ValueStack}.
*/
ValueStack createValueStack(ValueStack stack);
-
+
+ default ValueStack createValueStack(org.apache.struts2.util.ValueStack stack) {
+ return createValueStack(ValueStack.adapt(stack));
+ }
}
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
similarity index 96%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
index 9edafe3fc..7fa112a83 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/AliasInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/AliasInterceptor.java
@@ -16,25 +16,27 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.interceptor.ParametersInterceptor;
+import com.opensymphony.xwork2.interceptor.ValidationAware;
import com.opensymphony.xwork2.security.AcceptedPatternsChecker;
import com.opensymphony.xwork2.security.ExcludedPatternsChecker;
import com.opensymphony.xwork2.util.ClearableValueStack;
import com.opensymphony.xwork2.util.Evaluated;
-import com.opensymphony.xwork2.LocalizedTextProvider;
-import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.ActionInvocation;
+import org.apache.struts2.StrutsConstants;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.Parameter;
-import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.util.ValueStack;
import java.util.Map;
@@ -108,7 +110,7 @@ public class AliasInterceptor extends AbstractInterceptor {
@Inject(StrutsConstants.STRUTS_DEVMODE)
public void setDevMode(String mode) {
this.devMode = Boolean.parseBoolean(mode);
- }
+ }
@Inject
public void setValueStackFactory(ValueStackFactory valueStackFactory) {
@@ -210,7 +212,7 @@ public class AliasInterceptor extends AbstractInterceptor {
"Unexpected Exception caught setting '" + entry.getKey() + "' on '" + action.getClass() + ": " + e.getMessage()
});
LOG.error(developerNotification);
- if (action instanceof ValidationAware) {
+ if (action instanceof com.opensymphony.xwork2.interceptor.ValidationAware) {
((ValidationAware) action).addActionMessage(developerNotification);
}
}
@@ -225,7 +227,7 @@ public class AliasInterceptor extends AbstractInterceptor {
LOG.debug("invalid alias expression: {}", aliasesKey);
}
}
-
+
return invocation.invoke();
}
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ChainingInterceptor.java
similarity index 95%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/ChainingInterceptor.java
index 31b0075a3..adbb3a67a 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ChainingInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ChainingInterceptor.java
@@ -16,23 +16,28 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionChainResult;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.Unchainable;
import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.ProxyUtil;
import com.opensymphony.xwork2.util.CompoundRoot;
+import com.opensymphony.xwork2.util.ProxyUtil;
import com.opensymphony.xwork2.util.TextParseUtil;
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionInvocation;
+import org.apache.struts2.Result;
import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.util.ValueStack;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
/**
@@ -42,7 +47,7 @@ import java.util.*;
* except for any object that implements {@link Unchainable}. A collection of optional <i>includes</i> and
* <i>excludes</i> may be provided to control how and which parameters are copied. Only includes or excludes may be
* specified. Specifying both results in undefined behavior. See the javadocs for {@link ReflectionProvider#copy(Object, Object,
- * java.util.Map, java.util.Collection, java.util.Collection)} for more information.
+ * Map, Collection, Collection)} for more information.
* </p>
*
* <p>
@@ -112,7 +117,7 @@ import java.util.*;
*
* @author mrdon
* @author tm_jee ( tm_jee(at)yahoo.co.uk )
- * @see com.opensymphony.xwork2.ActionChainResult
+ * @see ActionChainResult
*/
public class ChainingInterceptor extends AbstractInterceptor {
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ConversionErrorInterceptor.java
similarity index 88%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/ConversionErrorInterceptor.java
index ee8e39281..0301441e5 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ConversionErrorInterceptor.java
@@ -16,14 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.conversion.impl.ConversionData;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
-import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.interceptor.ValidationAware;
import org.apache.commons.text.StringEscapeUtils;
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.ActionInvocation;
+import org.apache.struts2.util.ValueStack;
import java.util.HashMap;
import java.util.Map;
@@ -35,19 +36,19 @@ import java.util.Map;
*
* <p>
* This interceptor adds any error found in the {@link ActionContext}'s conversionErrors map as a field error (provided
- * that the action implements {@link ValidationAware}). In addition, any field that contains a validation error has its
+ * that the action implements {@link com.opensymphony.xwork2.interceptor.ValidationAware}). In addition, any field that contains a validation error has its
* original value saved such that any subsequent requests for that value return the original value rather than the value
* in the action. This is important because if the value "abc" is submitted and can't be converted to an int, we want to
* display the original string ("abc") again rather than the int value (likely 0, which would make very little sense to
* the user).
* </p>
- *
+ *
* <p>
- * <b>Note:</b> Since 2.5.2, this interceptor extends {@link MethodFilterInterceptor}, therefore being
+ * <b>Note:</b> Since 2.5.2, this interceptor extends {@link com.opensymphony.xwork2.interceptor.MethodFilterInterceptor}, therefore being
* able to deal with excludeMethods / includeMethods parameters. See [Workflow Interceptor]
* (class {@link DefaultWorkflowInterceptor}) for documentation and examples on how to use this feature.
* </p>
- *
+ *
* <!-- END SNIPPET: description -->
*
* <p><u>Interceptor parameters:</u></p>
@@ -114,8 +115,8 @@ public class ConversionErrorInterceptor extends MethodFilterInterceptor {
String message = XWorkConverter.getConversionErrorMessage(propertyName, conversionData.getToClass(), stack);
Object action = invocation.getAction();
- if (action instanceof ValidationAware) {
- ValidationAware va = (ValidationAware) action;
+ if (action instanceof com.opensymphony.xwork2.interceptor.ValidationAware) {
+ com.opensymphony.xwork2.interceptor.ValidationAware va = (ValidationAware) action;
va.addFieldError(propertyName, message);
}
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/DefaultWorkflowInterceptor.java
similarity index 88%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/DefaultWorkflowInterceptor.java
index d2cbd0b78..c51554d01 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/DefaultWorkflowInterceptor.java
@@ -16,20 +16,23 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.Action;
-import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.interceptor.ValidationAware;
+import com.opensymphony.xwork2.interceptor.ValidationErrorAware;
+import com.opensymphony.xwork2.interceptor.ValidationWorkflowAware;
import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionInvocation;
/**
* <!-- START SNIPPET: description -->
* <p>
- * An interceptor that makes sure there are not validation, conversion or action errors before allowing the interceptor chain to continue.
+ * An interceptor that makes sure there are not validation, conversion or action errors before allowing the interceptor chain to continue.
* If a single FieldError or ActionError (including the ones replicated by the Message Store Interceptor in a redirection) is found, the INPUT result will be triggered.
* <b>This interceptor does not perform any validation</b>.
* </p>
@@ -47,7 +50,7 @@ import org.apache.logging.log4j.Logger;
* for the interceptor element, naming either a list of excluded method names and/or a list of included method
* names, whereby includeMethods overrides excludedMethods. A single * sign is interpreted as wildcard matching
* all methods for both parameters.
- * See {@link MethodFilterInterceptor} for more info.
+ * See {@link com.opensymphony.xwork2.interceptor.MethodFilterInterceptor} for more info.
* </p>
*
* <p>
@@ -161,8 +164,8 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
protected String doIntercept(ActionInvocation invocation) throws Exception {
Object action = invocation.getAction();
- if (action instanceof ValidationAware) {
- ValidationAware validationAwareAction = (ValidationAware) action;
+ if (action instanceof com.opensymphony.xwork2.interceptor.ValidationAware) {
+ com.opensymphony.xwork2.interceptor.ValidationAware validationAwareAction = (ValidationAware) action;
if (validationAwareAction.hasErrors()) {
LOG.debug("Errors on action [{}], returning result name [{}]", validationAwareAction, inputResultName);
@@ -180,7 +183,7 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
}
/**
- * Process {@link ValidationWorkflowAware} interface
+ * Process {@link com.opensymphony.xwork2.interceptor.ValidationWorkflowAware} interface
*
* @param action action object
* @param currentResultName current result name
@@ -189,8 +192,8 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
*/
private String processValidationWorkflowAware(final Object action, final String currentResultName) {
String resultName = currentResultName;
- if (action instanceof ValidationWorkflowAware) {
- resultName = ((ValidationWorkflowAware) action).getInputResultName();
+ if (action instanceof com.opensymphony.xwork2.interceptor.ValidationWorkflowAware) {
+ resultName = ((com.opensymphony.xwork2.interceptor.ValidationWorkflowAware) action).getInputResultName();
LOG.debug("Changing result name from [{}] to [{}] because of processing [{}] interface applied to [{}]",
currentResultName, resultName, ValidationWorkflowAware.class.getSimpleName(), action);
}
@@ -224,18 +227,18 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
}
/**
- * Notify action if it implements {@link ValidationErrorAware} interface
+ * Notify action if it implements {@link com.opensymphony.xwork2.interceptor.ValidationErrorAware} interface
*
* @param action action object
* @param currentResultName current result name
*
* @return result name
- * @see ValidationErrorAware
+ * @see com.opensymphony.xwork2.interceptor.ValidationErrorAware
*/
protected String processValidationErrorAware(final Object action, final String currentResultName) {
String resultName = currentResultName;
- if (action instanceof ValidationErrorAware) {
- resultName = ((ValidationErrorAware) action).actionErrorOccurred(currentResultName);
+ if (action instanceof com.opensymphony.xwork2.interceptor.ValidationErrorAware) {
+ resultName = ((com.opensymphony.xwork2.interceptor.ValidationErrorAware) action).actionErrorOccurred(currentResultName);
LOG.debug("Changing result name from [{}] to [{}] because of processing interface [{}] on action [{}]",
currentResultName, resultName, ValidationErrorAware.class.getSimpleName(), action);
}
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ExceptionMappingInterceptor.java
similarity index 98%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/ExceptionMappingInterceptor.java
index e60550ca6..277fc33df 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ExceptionMappingInterceptor.java
@@ -16,12 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.config.entities.ExceptionMappingConfig;
-import org.apache.logging.log4j.Logger;
+import com.opensymphony.xwork2.interceptor.ExceptionHolder;
import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionInvocation;
import org.apache.struts2.dispatcher.HttpParameters;
import java.util.List;
@@ -72,7 +73,7 @@ import java.util.Map;
* <!-- START SNIPPET: extending -->
* <p>
* If you want to add custom handling for publishing the Exception, you may override
- * {@link #publishException(com.opensymphony.xwork2.ActionInvocation, ExceptionHolder)}. The default implementation
+ * {@link #publishException(ActionInvocation, ExceptionHolder)}. The default implementation
* pushes the given ExceptionHolder on value stack. A custom implementation could add additional logging etc.
* </p>
* <!-- END SNIPPET: extending -->
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/LoggingInterceptor.java
similarity index 97%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/LoggingInterceptor.java
index 6ba498b3c..4536d462b 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/LoggingInterceptor.java
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionInvocation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionInvocation;
/**
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ModelDrivenInterceptor.java
similarity index 96%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/ModelDrivenInterceptor.java
index fa90a315c..aeaf0a040 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ModelDrivenInterceptor.java
@@ -16,12 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.util.CompoundRoot;
-import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.struts2.ActionInvocation;
+import org.apache.struts2.interceptor.parameter.ParametersInterceptor;
+import org.apache.struts2.util.ValueStack;
/**
* <!-- START SNIPPET: description -->
@@ -71,7 +72,7 @@ import com.opensymphony.xwork2.util.ValueStack;
* </action>
* <!-- END SNIPPET: example -->
* </pre>
- *
+ *
* @author tm_jee
* @version $Date$ $Id$
*/
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ParameterRemoverInterceptor.java
similarity index 95%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/ParameterRemoverInterceptor.java
index c0f83765c..ad72d5853 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParameterRemoverInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ParameterRemoverInterceptor.java
@@ -16,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.util.TextParseUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.ActionInvocation;
import org.apache.struts2.action.NoParameters;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.Parameter;
@@ -78,7 +78,7 @@ public class ParameterRemoverInterceptor extends AbstractInterceptor {
* Decide if the parameter should be removed from the parameter map based on
* <code>paramNames</code> and <code>paramValues</code>.
*
- * @see com.opensymphony.xwork2.interceptor.AbstractInterceptor
+ * @see AbstractInterceptor
*/
@Override
public String intercept(ActionInvocation invocation) throws Exception {
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/PrepareInterceptor.java
similarity index 96%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/PrepareInterceptor.java
index 4516d760c..f45a501d4 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/PrepareInterceptor.java
@@ -16,12 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Preparable;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
+import com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil;
+import org.apache.struts2.ActionInvocation;
import java.lang.reflect.InvocationTargetException;
@@ -43,7 +42,7 @@ import java.lang.reflect.InvocationTargetException;
* loaded from the database. See the example for more info.
* </p>
* <p>
- * <b>Note:</b> Since XWork 2.0.2, this interceptor extends {@link MethodFilterInterceptor}, therefore being
+ * <b>Note:</b> Since XWork 2.0.2, this interceptor extends {@link com.opensymphony.xwork2.interceptor.MethodFilterInterceptor}, therefore being
* able to deal with excludeMethods / includeMethods parameters. See [Workflow Interceptor]
* (class {@link DefaultWorkflowInterceptor}) for documentation and examples on how to use this feature.
* </p>
@@ -97,7 +96,7 @@ import java.lang.reflect.InvocationTargetException;
* @author Jason Carreira
* @author Philip Luppens
* @author tm_jee
- * @see com.opensymphony.xwork2.Preparable
+ * @see Preparable
*/
public class PrepareInterceptor extends MethodFilterInterceptor {
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ScopedModelDrivenInterceptor.java
similarity index 91%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/ScopedModelDrivenInterceptor.java
index 22da179d4..f474770f0 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ScopedModelDrivenInterceptor.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.interceptor.ScopedModelDriven;
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.ActionInvocation;
import org.apache.struts2.StrutsException;
import java.lang.reflect.Method;
@@ -33,9 +34,9 @@ import java.util.Map;
*
* An interceptor that enables scoped model-driven actions.
*
- * <p>This interceptor only activates on actions that implement the {@link ScopedModelDriven} interface. If
+ * <p>This interceptor only activates on actions that implement the {@link com.opensymphony.xwork2.interceptor.ScopedModelDriven} interface. If
* detected, it will retrieve the model class from the configured scope, then provide it to the Action.</p>
- *
+ *
* <!-- END SNIPPET: description -->
*
* <p><u>Interceptor parameters:</u></p>
@@ -45,7 +46,7 @@ import java.util.Map;
* <ul>
*
* <li>className - The model class name. Defaults to the class name of the object returned by the getModel() method.</li>
- *
+ *
* <li>name - The key to use when storing or retrieving the instance in a scope. Defaults to the model
* class name.</li>
*
@@ -66,42 +67,42 @@ import java.util.Map;
*
* <pre>
* <!-- START SNIPPET: example -->
- *
+ *
* <-- Basic usage -->
* <interceptor name="scopedModelDriven" class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor" />
- *
+ *
* <-- Using all available parameters -->
* <interceptor name="gangsterForm" class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor">
* <param name="scope">session</param>
* <param name="name">gangsterForm</param>
* <param name="className">com.opensymphony.example.GangsterForm</param>
* </interceptor>
- *
+ *
* <!-- END SNIPPET: example -->
* </pre>
*/
public class ScopedModelDrivenInterceptor extends AbstractInterceptor {
private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
-
+
private static final String GET_MODEL = "getModel";
private String scope;
private String name;
private String className;
private ObjectFactory objectFactory;
-
+
@Inject
public void setObjectFactory(ObjectFactory factory) {
this.objectFactory = factory;
}
-
+
protected Object resolveModel(ObjectFactory factory, ActionContext actionContext, String modelClassName, String modelScope, String modelName) throws Exception {
Object model;
Map<String, Object> scopeMap = actionContext.getContextMap();
if ("session".equals(modelScope)) {
scopeMap = actionContext.getSession();
}
-
+
model = scopeMap.get(modelName);
if (model == null) {
model = factory.buildBean(modelClassName, null);
@@ -114,12 +115,12 @@ public class ScopedModelDrivenInterceptor extends AbstractInterceptor {
public String intercept(ActionInvocation invocation) throws Exception {
Object action = invocation.getAction();
- if (action instanceof ScopedModelDriven) {
- ScopedModelDriven modelDriven = (ScopedModelDriven) action;
+ if (action instanceof com.opensymphony.xwork2.interceptor.ScopedModelDriven) {
+ com.opensymphony.xwork2.interceptor.ScopedModelDriven modelDriven = (ScopedModelDriven) action;
if (modelDriven.getModel() == null) {
ActionContext ctx = ActionContext.getContext();
ActionConfig config = invocation.getProxy().getConfig();
-
+
String cName = className;
if (cName == null) {
try {
@@ -161,5 +162,5 @@ public class ScopedModelDrivenInterceptor extends AbstractInterceptor {
*/
public void setScope(String scope) {
this.scope = scope;
- }
+ }
}
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
similarity index 95%
copy from core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
index 9d32a8a18..ec0581a73 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/StaticParametersInterceptor.java
@@ -16,24 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.config.entities.Parameterizable;
import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.interceptor.ParametersInterceptor;
+import com.opensymphony.xwork2.interceptor.ValidationAware;
import com.opensymphony.xwork2.util.ClearableValueStack;
-import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.util.TextParseUtil;
-import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionContext;
+import org.apache.struts2.ActionInvocation;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.dispatcher.HttpParameters;
+import org.apache.struts2.util.ValueStack;
import java.util.Collections;
import java.util.Map;
@@ -181,7 +183,7 @@ public class StaticParametersInterceptor extends AbstractInterceptor {
"Unexpected Exception caught setting '" + entry.getKey() + "' on '" + action.getClass() + ": " + e.getMessage()
});
LOG.error(developerNotification);
- if (action instanceof ValidationAware) {
+ if (action instanceof com.opensymphony.xwork2.interceptor.ValidationAware) {
((ValidationAware) action).addActionMessage(developerNotification);
}
}