405d4072 by Adam Heath

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.
1 parent 8dffc69e
......@@ -110,6 +110,12 @@ public class DirectControlServlet extends HttpServlet {
// Determine type of request and load the context from JSON content or
// parameter values accordingly
if (contentType != null) {
int semi = contentType.indexOf(";");
if (semi != -1) {
contentType = contentType.substring(0, semi);
}
}
// Determine the request method for service lookup and parameter filters
String method = "";
......@@ -122,7 +128,7 @@ public class DirectControlServlet extends HttpServlet {
Map<String, Object> context = new HashMap<String, Object>();
if ("application/json".equals(contentType)) {
// Read request body as JSON and insert into the context
JSON json = new JSON(new InputStreamReader(request.getInputStream()));
JSON json = new JSON(request.getReader());
Map<String,Object> items = json.JSONObject();
for (String key : items.keySet()) {
context.put(key, items.get(key));
......