This is an automated email from the ASF dual-hosted git repository.

kusal pushed a commit to branch kusal-depr-apis
in repository https://gitbox.apache.org/repos/asf/struts.git

commit bcb66a0e4cfebc3a43bcde4146fd347118455583
Author: Kusal Kithul-Godage <g...@kusal.io>
AuthorDate: Thu Oct 17 13:12:57 2024 +1100

    WW-3714 Deprecate and migrate Action, Interceptor, Result
---
 .../main/java/com/opensymphony/xwork2/Action.java  |  70 +------
 .../main/java/com/opensymphony/xwork2/Result.java  |  30 +--
 .../xwork2/interceptor/Interceptor.java            | 202 +--------------------
 .../xwork2 => org/apache/struts2}/Action.java      |  14 +-
 .../xwork2 => org/apache/struts2}/Result.java      |   5 +-
 .../apache/struts2}/interceptor/Interceptor.java   |   4 +-
 6 files changed, 26 insertions(+), 299 deletions(-)

diff --git a/core/src/main/java/com/opensymphony/xwork2/Action.java 
b/core/src/main/java/com/opensymphony/xwork2/Action.java
index 4c96617c4..57d767834 100644
--- a/core/src/main/java/com/opensymphony/xwork2/Action.java
+++ b/core/src/main/java/com/opensymphony/xwork2/Action.java
@@ -19,70 +19,10 @@
 package com.opensymphony.xwork2;
 
 /**
- * All actions <b>may</b> implement this interface, which exposes the 
<code>execute()</code> method.
- * <p>
- * However, as of XWork 1.1, this is <b>not</b> required and is only here to 
assist users. You are free to create POJOs
- * that honor the same contract defined by this interface without actually 
implementing the interface.
- * </p>
+ * {@inheritDoc}
+ *
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.Action} instead.
  */
-public interface Action {
-
-    /**
-     * The action execution was successful. Show result
-     * view to the end user.
-     */
-    public static final String SUCCESS = "success";
-
-    /**
-     * The action execution was successful but do not
-     * show a view. This is useful for actions that are
-     * handling the view in another fashion like redirect.
-     */
-    public static final String NONE = "none";
-
-    /**
-     * The action execution was a failure.
-     * Show an error view, possibly asking the
-     * user to retry entering data.
-     */
-    public static final String ERROR = "error";
-
-    /**
-     * <p>
-     * The action execution require more input
-     * in order to succeed.
-     * This result is typically used if a form
-     * handling action has been executed so as
-     * to provide defaults for a form. The
-     * form associated with the handler should be
-     * shown to the end user.
-     * </p>
-     *
-     * <p>
-     * This result is also used if the given input
-     * params are invalid, meaning the user
-     * should try providing input again.
-     * </p>
-     */
-    public static final String INPUT = "input";
-
-    /**
-     * The action could not execute, since the
-     * user most was not logged in. The login view
-     * should be shown.
-     */
-    public static final String LOGIN = "login";
-
-
-    /**
-     * Where the logic of the action is executed.
-     *
-     * @return a string representing the logical result of the execution.
-     *         See constants in this interface for a list of standard result 
values.
-     * @throws Exception thrown if a system level exception occurs.
-     *                   <b>Note:</b> Application level exceptions should be 
handled by returning
-     *                   an error value, such as <code>Action.ERROR</code>.
-     */
-    public String execute() throws Exception;
-
+@Deprecated
+public interface Action extends org.apache.struts2.Action {
 }
diff --git a/core/src/main/java/com/opensymphony/xwork2/Result.java 
b/core/src/main/java/com/opensymphony/xwork2/Result.java
index 8c1687e5a..ccd238751 100644
--- a/core/src/main/java/com/opensymphony/xwork2/Result.java
+++ b/core/src/main/java/com/opensymphony/xwork2/Result.java
@@ -18,33 +18,11 @@
  */
 package com.opensymphony.xwork2;
 
-import java.io.Serializable;
-
 /**
- * All results (except for <code>Action.NONE</code>) of an {@link Action} are 
mapped to a View implementation.
- *
- * <p>
- * Examples of Views might be:
- * </p>
- *
- * <ul>
- * <li>SwingPanelView - pops up a new Swing panel</li>
- * <li>ActionChainView - executes another action</li>
- * <li>SerlvetRedirectView - redirects the HTTP response to a URL</li>
- * <li>ServletDispatcherView - dispatches the HTTP response to a URL</li>
- * </ul>
+ * {@inheritDoc}
  *
- * @author plightbo
+ * @deprecated since 6.7.0, use {@link org.apache.struts2.Result} instead.
  */
-public interface Result extends Serializable {
-
-    /**
-     * Represents a generic interface for all action execution results.
-     * Whether that be displaying a webpage, generating an email, sending a 
JMS message, etc.
-     *
-     * @param invocation  the invocation context.
-     * @throws Exception can be thrown.
-     */
-    void execute(ActionInvocation invocation) throws Exception;
-
+@Deprecated
+public interface Result extends org.apache.struts2.Result {
 }
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java 
b/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java
index cafa08fc0..87041a269 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java
@@ -18,205 +18,11 @@
  */
 package com.opensymphony.xwork2.interceptor;
 
-import com.opensymphony.xwork2.ActionInvocation;
-
-import java.io.Serializable;
-
 /**
- * <!-- START SNIPPET: introduction -->
- *
- * <p>
- * An interceptor is a stateless class that follows the interceptor pattern, as
- * found in {@link  javax.servlet.Filter} and in AOP languages.
- * </p>
- *
- * <p>
- * Interceptors are objects that dynamically intercept Action invocations.
- * They provide the developer with the opportunity to define code that can be 
executed
- * before and/or after the execution of an action. They also have the ability
- * to prevent an action from executing. Interceptors provide developers a way 
to
- * encapsulate common functionality in a re-usable form that can be applied to
- * one or more Actions.
- * </p>
- *
- * <p>
- * Interceptors <b>must</b> be stateless and not assume that a new instance 
will be created for each request or Action.
- * Interceptors may choose to either short-circuit the {@link 
ActionInvocation} execution and return a return code
- * (such as {@link com.opensymphony.xwork2.Action#SUCCESS}), or it may choose 
to do some processing before
- * and/or after delegating the rest of the procesing using {@link 
ActionInvocation#invoke()}.
- * </p>
- * <!-- END SNIPPET: introduction -->
- *
- * <!-- START SNIPPET: parameterOverriding -->
- * <p>
- * Interceptor's parameter could be overridden through the following ways :-
- * </p>
-
- * <b>Method 1:</b>
- * <pre>
- * &lt;action name=&quot;myAction&quot; class=&quot;myActionClass&quot;&gt;
- *     &lt;interceptor-ref name=&quot;exception&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;alias&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;params&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;servletConfig&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;prepare&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;i18n&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;chain&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;modelDriven&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;fileUpload&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;staticParams&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;params&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;conversionError&quot;/&gt;
- *     &lt;interceptor-ref name=&quot;validation&quot;&gt;
- *     &lt;param 
name=&quot;excludeMethods&quot;&gt;myValidationExcudeMethod&lt;/param&gt;
- *     &lt;/interceptor-ref&gt;
- *     &lt;interceptor-ref name=&quot;workflow&quot;&gt;
- *     &lt;param 
name=&quot;excludeMethods&quot;&gt;myWorkflowExcludeMethod&lt;/param&gt;
- *     &lt;/interceptor-ref&gt;
- * &lt;/action&gt;
- * </pre>
- *
- * <b>Method 2:</b>
- * <pre>
- * &lt;action name=&quot;myAction&quot; class=&quot;myActionClass&quot;&gt;
- *   &lt;interceptor-ref name=&quot;defaultStack&quot;&gt;
- *     &lt;param 
name=&quot;validation.excludeMethods&quot;&gt;myValidationExcludeMethod&lt;/param&gt;
- *     &lt;param 
name=&quot;workflow.excludeMethods&quot;&gt;myWorkflowExcludeMethod&lt;/param&gt;
- *   &lt;/interceptor-ref&gt;
- * &lt;/action&gt;
- * </pre>
- *
- * <p>
- * In the first method, the whole default stack is copied and the parameter 
then
- * changed accordingly.
- * </p>
- *
- * <p>
- * In the second method, the 'interceptor-ref' refer to an existing
- * interceptor-stack, namely defaultStack in this example, and override the 
validator
- * and workflow interceptor excludeMethods typically in this case. Note that 
in the
- * 'param' tag, the name attribute contains a dot (.) the word before the 
dot(.)
- * specifies the interceptor name whose parameter is to be overridden and the 
word after
- * the dot (.) specifies the parameter itself. Essetially it is as follows :-
- * </p>
- *
- * <pre>
- *    &lt;interceptor-name&gt;.&lt;parameter-name&gt;
- * </pre>
- * <p>
- * <b>Note</b> also that in this case the 'interceptor-ref' name attribute
- * is used to indicate an interceptor stack which makes sense as if it is 
referring
- * to the interceptor itself it would be just using Method 1 describe above.
- * </p>
- * <!-- END SNIPPET: parameterOverriding -->
- *
- * <p>
- * <b>Nested Interceptor param overriding</b>
- * </p>
+ * {@inheritDoc}
  *
- * <!-- START SNIPPET: nestedParameterOverriding -->
- * <p>
- * Interceptor stack parameter overriding could be nested into as many level 
as possible, though it would
- * be advisable not to nest it too deep as to avoid confusion, For example,
- * </p>
- * <pre>
- * &lt;interceptor name=&quot;interceptor1&quot; 
class=&quot;foo.bar.Interceptor1&quot; /&gt;
- * &lt;interceptor name=&quot;interceptor2&quot; 
class=&quot;foo.bar.Interceptor2&quot; /&gt;
- * &lt;interceptor name=&quot;interceptor3&quot; 
class=&quot;foo.bar.Interceptor3&quot; /&gt;
- * &lt;interceptor name=&quot;interceptor4&quot; 
class=&quot;foo.bar.Interceptor4&quot; /&gt;
- * &lt;interceptor-stack name=&quot;stack1&quot;&gt;
- *     &lt;interceptor-ref name=&quot;interceptor1&quot; /&gt;
- * &lt;/interceptor-stack&gt;
- * &lt;interceptor-stack name=&quot;stack2&quot;&gt;
- *     &lt;interceptor-ref name=&quot;intercetor2&quot; /&gt;
- *     &lt;interceptor-ref name=&quot;stack1&quot; /&gt;
- * &lt;/interceptor-stack&gt;
- * &lt;interceptor-stack name=&quot;stack3&quot;&gt;
- *     &lt;interceptor-ref name=&quot;interceptor3&quot; /&gt;
- *     &lt;interceptor-ref name=&quot;stack2&quot; /&gt;
- * &lt;/interceptor-stack&gt;
- * &lt;interceptor-stack name=&quot;stack4&quot;&gt;
- *     &lt;interceptor-ref name=&quot;interceptor4&quot; /&gt;
- *     &lt;interceptor-ref name=&quot;stack3&quot; /&gt;
- *  &lt;/interceptor-stack&gt;
- * </pre>
- *
- * <p>
- * Assuming the interceptor has the following properties
- * </p>
- *
- * <table border="1" summary="">
- * <tr>
- * <td>Interceptor</td>
- * <td>property</td>
- * </tr>
- * <tr>
- * <td>Interceptor1</td>
- * <td>param1</td>
- * </tr>
- * <tr>
- * <td>Interceptor2</td>
- * <td>param2</td>
- * </tr>
- * <tr>
- * <td>Interceptor3</td>
- * <td>param3</td>
- * </tr>
- * <tr>
- * <td>Interceptor4</td>
- * <td>param4</td>
- * </tr>
- * </table>
- *
- * <p>
- * We could override them as follows :
- * </p>
- *
- * <pre>
- *    &lt;action ... &gt;
- *        &lt;!-- to override parameters of interceptor located directly in 
the stack  --&gt;
- *        &lt;interceptor-ref name=&quot;stack4&quot;&gt;
- *           &lt;param name=&quot;interceptor4.param4&quot;&gt; ... 
&lt;/param&gt;
- *        &lt;/interceptor-ref&gt;
- *    &lt;/action&gt;
- *
- *    &lt;action ... &gt;
- *        &lt;!-- to override parameters of interceptor located under nested 
stack --&gt;
- *        &lt;interceptor-ref name=&quot;stack4&quot;&gt;
- *            &lt;param name=&quot;stack3.interceptor3.param3&quot;&gt; ... 
&lt;/param&gt;
- *            &lt;param name=&quot;stack3.stack2.interceptor2.param2&quot;&gt; 
... &lt;/param&gt;
- *            &lt;param 
name=&quot;stack3.stack2.stack1.interceptor1.param1&quot;&gt; ... &lt;/param&gt;
- *        &lt;/interceptor-ref&gt;
- *    &lt;/action&gt;
- *  </pre>
- *
- * <!-- END SNIPPET: nestedParameterOverriding -->
- *
- * @author Jason Carreira
- * @author tmjee
+ * @deprecated since 6.7.0, use {@link 
org.apache.struts2.interceptor.Interceptor} instead.
  */
-public interface Interceptor extends Serializable {
-
-    /**
-     * Called to let an interceptor clean up any resources it has allocated.
-     */
-    void destroy();
-
-    /**
-     * Called after an interceptor is created, but before any requests are 
processed using
-     * {@link #intercept(com.opensymphony.xwork2.ActionInvocation) intercept} 
, giving
-     * the Interceptor a chance to initialize any needed resources.
-     */
-    void init();
-
-    /**
-     * Allows the Interceptor to do some processing on the request before 
and/or after the rest of the processing of the
-     * request by the {@link ActionInvocation} or to short-circuit the 
processing and just return a String return code.
-     *
-     * @param invocation the action invocation
-     * @return the return code, either returned from {@link 
ActionInvocation#invoke()}, or from the interceptor itself.
-     * @throws Exception any system-level error, as defined in {@link 
com.opensymphony.xwork2.Action#execute()}.
-     */
-    String intercept(ActionInvocation invocation) throws Exception;
-
+@Deprecated
+public interface Interceptor extends 
org.apache.struts2.interceptor.Interceptor {
 }
diff --git a/core/src/main/java/com/opensymphony/xwork2/Action.java 
b/core/src/main/java/org/apache/struts2/Action.java
similarity index 89%
copy from core/src/main/java/com/opensymphony/xwork2/Action.java
copy to core/src/main/java/org/apache/struts2/Action.java
index 4c96617c4..cc3fb83ac 100644
--- a/core/src/main/java/com/opensymphony/xwork2/Action.java
+++ b/core/src/main/java/org/apache/struts2/Action.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.opensymphony.xwork2;
+package org.apache.struts2;
 
 /**
  * All actions <b>may</b> implement this interface, which exposes the 
<code>execute()</code> method.
@@ -31,21 +31,21 @@ public interface Action {
      * The action execution was successful. Show result
      * view to the end user.
      */
-    public static final String SUCCESS = "success";
+    String SUCCESS = "success";
 
     /**
      * The action execution was successful but do not
      * show a view. This is useful for actions that are
      * handling the view in another fashion like redirect.
      */
-    public static final String NONE = "none";
+    String NONE = "none";
 
     /**
      * The action execution was a failure.
      * Show an error view, possibly asking the
      * user to retry entering data.
      */
-    public static final String ERROR = "error";
+    String ERROR = "error";
 
     /**
      * <p>
@@ -64,14 +64,14 @@ public interface Action {
      * should try providing input again.
      * </p>
      */
-    public static final String INPUT = "input";
+    String INPUT = "input";
 
     /**
      * The action could not execute, since the
      * user most was not logged in. The login view
      * should be shown.
      */
-    public static final String LOGIN = "login";
+    String LOGIN = "login";
 
 
     /**
@@ -83,6 +83,6 @@ public interface Action {
      *                   <b>Note:</b> Application level exceptions should be 
handled by returning
      *                   an error value, such as <code>Action.ERROR</code>.
      */
-    public String execute() throws Exception;
+    String execute() throws Exception;
 
 }
diff --git a/core/src/main/java/com/opensymphony/xwork2/Result.java 
b/core/src/main/java/org/apache/struts2/Result.java
similarity index 93%
copy from core/src/main/java/com/opensymphony/xwork2/Result.java
copy to core/src/main/java/org/apache/struts2/Result.java
index 8c1687e5a..4dc912772 100644
--- a/core/src/main/java/com/opensymphony/xwork2/Result.java
+++ b/core/src/main/java/org/apache/struts2/Result.java
@@ -16,7 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.opensymphony.xwork2;
+package org.apache.struts2;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionInvocation;
 
 import java.io.Serializable;
 
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java 
b/core/src/main/java/org/apache/struts2/interceptor/Interceptor.java
similarity index 98%
copy from 
core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java
copy to core/src/main/java/org/apache/struts2/interceptor/Interceptor.java
index cafa08fc0..9c36bde77 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/Interceptor.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.opensymphony.xwork2.interceptor;
+package org.apache.struts2.interceptor;
 
 import com.opensymphony.xwork2.ActionInvocation;
 
@@ -204,7 +204,7 @@ public interface Interceptor extends Serializable {
 
     /**
      * Called after an interceptor is created, but before any requests are 
processed using
-     * {@link #intercept(com.opensymphony.xwork2.ActionInvocation) intercept} 
, giving
+     * {@link #intercept(ActionInvocation) intercept} , giving
      * the Interceptor a chance to initialize any needed resources.
      */
     void init();

Reply via email to