BinaryResult: Use Charset for setCharacterEncoding

Instead of using a String which is then converted to a Charset, use
the Charset directly.

Change-Id: I4e481286d5554b0f550c68992c266c06a9239340
This commit is contained in:
David Pursehouse
2015-10-17 00:02:27 +09:00
parent 746ca2e4d4
commit a1d9f76ea6
5 changed files with 18 additions and 12 deletions

View File

@@ -669,7 +669,7 @@ public class RestApiServlet extends HttpServlet {
w.flush();
replyBinaryResult(req, res, asBinaryResult(buf)
.setContentType(JSON_TYPE)
.setCharacterEncoding(UTF_8.name()));
.setCharacterEncoding(UTF_8));
}
private static Gson newGson(Multimap<String, String> config,
@@ -791,7 +791,7 @@ public class RestApiServlet extends HttpServlet {
res.setHeader("X-FYI-Content-Type", src.getContentType());
return asBinaryResult(buf)
.setContentType(JSON_TYPE)
.setCharacterEncoding(UTF_8.name());
.setCharacterEncoding(UTF_8);
}
private static BinaryResult stackBase64(HttpServletResponse res,
@@ -819,7 +819,7 @@ public class RestApiServlet extends HttpServlet {
}
res.setHeader("X-FYI-Content-Encoding", "base64");
res.setHeader("X-FYI-Content-Type", src.getContentType());
return b64.setContentType("text/plain").setCharacterEncoding(ISO_8859_1.name());
return b64.setContentType("text/plain").setCharacterEncoding(ISO_8859_1);
}
private static BinaryResult stackGzip(HttpServletResponse res,