struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [4/7] struts git commit: Updates flow to handle new API
Date Thu, 24 Aug 2017 07:11:38 GMT
Updates flow to handle new API


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/103e3b17
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/103e3b17
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/103e3b17

Branch: refs/heads/support-2-3
Commit: 103e3b174e497bbe7058919f12b9f48a0ddf6de3
Parents: 2776b34
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Wed Aug 2 14:59:54 2017 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Thu Aug 24 08:55:50 2017 +0200

----------------------------------------------------------------------
 .../org/apache/struts2/rest/ContentTypeHandlerManager.java    | 7 +++++++
 .../java/org/apache/struts2/rest/ContentTypeInterceptor.java  | 2 +-
 .../java/org/apache/struts2/rest/RestActionInvocation.java    | 4 +---
 .../java/org/apache/struts2/rest/RestWorkflowInterceptor.java | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/103e3b17/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
b/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
index 38ca89c..dee61fd 100644
--- a/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
+++ b/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java
@@ -21,6 +21,7 @@
 
 package org.apache.struts2.rest;
 
+import com.opensymphony.xwork2.ActionInvocation;
 import org.apache.struts2.rest.handler.ContentTypeHandler;
 
 import javax.servlet.http.HttpServletRequest;
@@ -58,10 +59,16 @@ public interface ContentTypeHandlerManager {
      * @param target The object to return, usually the action object
      * @return The new result code to process
      * @throws IOException If unable to write to the response
+     *
+     * @deprecated use version which requires {@link ActionInvocation}
      */
+    @Deprecated
     String handleResult(ActionConfig actionConfig, Object methodResult, Object target)
             throws IOException;
     
+    String handleResult(ActionInvocation actionInvocation, Object methodResult, Object target)
+            throws IOException;
+
     /**
      * Finds the extension in the url
      * 

http://git-wip-us.apache.org/repos/asf/struts/blob/103e3b17/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
b/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
index 7ee05a7..43c8189 100644
--- a/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
+++ b/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
@@ -61,7 +61,7 @@ public class ContentTypeInterceptor implements Interceptor {
         if (request.getContentLength() > 0) {
             InputStream is = request.getInputStream();
             InputStreamReader reader = new InputStreamReader(is);
-            handler.toObject(reader, target);
+            handler.toObject(invocation, reader, target);
         }
         return invocation.invoke();
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/103e3b17/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
b/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
index ed8c695..b1dd061 100644
--- a/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
+++ b/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
@@ -229,9 +229,7 @@ public class RestActionInvocation extends DefaultActionInvocation {
         if (handler != null && !(handler instanceof HtmlHandler)) {
 
             // Specific representation (json, xml...)
-            resultCode = handlerSelector.handleResult(
-                    this.getProxy().getConfig(), httpHeaders, target);
-
+            resultCode = handlerSelector.handleResult(this, httpHeaders, target);
         } else {
 
             // Normal struts execution (html o other struts result)

http://git-wip-us.apache.org/repos/asf/struts/blob/103e3b17/plugins/rest/src/main/java/org/apache/struts2/rest/RestWorkflowInterceptor.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/RestWorkflowInterceptor.java
b/plugins/rest/src/main/java/org/apache/struts2/rest/RestWorkflowInterceptor.java
index 72193ae..a4be522 100644
--- a/plugins/rest/src/main/java/org/apache/struts2/rest/RestWorkflowInterceptor.java
+++ b/plugins/rest/src/main/java/org/apache/struts2/rest/RestWorkflowInterceptor.java
@@ -221,7 +221,7 @@ public class RestWorkflowInterceptor extends MethodFilterInterceptor {
             	
             	errors.put("actionErrors", validationAwareAction.getActionErrors());
             	errors.put("fieldErrors", validationAwareAction.getFieldErrors());
-            	return manager.handleResult(invocation.getProxy().getConfig(), info, errors);
+            	return manager.handleResult(invocation, info, errors);
             }
         }
 


Mime
View raw message