ac02c978 by Ean Schuessler

Add a new option for returning HTML

Currently just renders the JSON into HTML. Should
probably look for a "body" attribute and use that
as a string... but it doesn't right now.
1 parent e2475825
......@@ -492,6 +492,18 @@ public class DirectControlServlet extends HttpServlet {
setResponseNoCache();
if ("HTML".equals(outputHandler)) {
response.setContentType("text/html; charset=utf-8");
PrintWriter writer = response.getWriter();
String jsonStr = JSON.from(result).toString();
response.setContentLength(jsonStr.getBytes("UTF-8").length);
writer.write(jsonStr);
writer.flush();
writer.close();
}
if ("JSON".equals(outputHandler)) {
response.setContentType("application/x-json;charset=UTF-8");
......