From 287e3bc8cbd66fdda04b075bc96362bfd3e2dce9 Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 2 Aug 2017 14:56:09 +0200 Subject: [PATCH] Adds new methods and marks current as deprecated --- .../rest/handler/ContentTypeHandler.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/ContentTypeHandler.java b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/ContentTypeHandler.java index 9ea78e891..a01557e57 100644 --- a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/ContentTypeHandler.java +++ b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/ContentTypeHandler.java @@ -21,6 +21,8 @@ package org.apache.struts2.rest.handler; +import com.opensymphony.xwork2.ActionInvocation; + import java.io.IOException; import java.io.Reader; import java.io.Writer; @@ -34,9 +36,15 @@ public interface ContentTypeHandler { * Populates an object using data from the input stream * @param in The input stream, usually the body of the request * @param target The target, usually the action class + * @throws IOException If unable to write to the output stream + * + * @deprecated use version which requires {@link ActionInvocation} */ + @Deprecated void toObject(Reader in, Object target) throws IOException; - + + void toObject(ActionInvocation invocation, Reader in, Object target) throws IOException; + /** * Writes content to the stream * @@ -45,9 +53,14 @@ public interface ContentTypeHandler { * @param stream The output stream, usually the response * @return The new result code * @throws IOException If unable to write to the output stream + * + * @deprecated use version which requires {@link ActionInvocation} */ + @Deprecated String fromObject(Object obj, String resultCode, Writer stream) throws IOException; - + + String fromObject(ActionInvocation invocation, Object obj, String resultCode, Writer stream) throws IOException; + /** * Gets the content type for this handler *