Issue #4170: Remove '; charset=xxx' from the contentType, then use
getReader instead of getInputStream; the former will use an appropriate charset decoder on the raw bytes.
Showing
1 changed file
with
7 additions
and
1 deletions
... | @@ -110,6 +110,12 @@ public class DirectControlServlet extends HttpServlet { | ... | @@ -110,6 +110,12 @@ public class DirectControlServlet extends HttpServlet { |
110 | 110 | ||
111 | // Determine type of request and load the context from JSON content or | 111 | // Determine type of request and load the context from JSON content or |
112 | // parameter values accordingly | 112 | // parameter values accordingly |
113 | if (contentType != null) { | ||
114 | int semi = contentType.indexOf(";"); | ||
115 | if (semi != -1) { | ||
116 | contentType = contentType.substring(0, semi); | ||
117 | } | ||
118 | } | ||
113 | 119 | ||
114 | // Determine the request method for service lookup and parameter filters | 120 | // Determine the request method for service lookup and parameter filters |
115 | String method = ""; | 121 | String method = ""; |
... | @@ -122,7 +128,7 @@ public class DirectControlServlet extends HttpServlet { | ... | @@ -122,7 +128,7 @@ public class DirectControlServlet extends HttpServlet { |
122 | Map<String, Object> context = new HashMap<String, Object>(); | 128 | Map<String, Object> context = new HashMap<String, Object>(); |
123 | if ("application/json".equals(contentType)) { | 129 | if ("application/json".equals(contentType)) { |
124 | // Read request body as JSON and insert into the context | 130 | // Read request body as JSON and insert into the context |
125 | JSON json = new JSON(new InputStreamReader(request.getInputStream())); | 131 | JSON json = new JSON(request.getReader()); |
126 | Map<String,Object> items = json.JSONObject(); | 132 | Map<String,Object> items = json.JSONObject(); |
127 | for (String key : items.keySet()) { | 133 | for (String key : items.keySet()) { |
128 | context.put(key, items.get(key)); | 134 | context.put(key, items.get(key)); | ... | ... |
-
Please register or sign in to post a comment