Console: Fix mime type and encoding on javadoc pages

This commit is contained in:
zzz
2019-10-10 14:48:23 +00:00
parent 31f2c51e7e
commit 049b34f7cf

View File

@@ -4,12 +4,15 @@
* Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!!
*
* Note: this also handles /javadoc/ URLs
*
* Do not tag this file for translation.
*/
String uri = request.getRequestURI();
if (uri.endsWith(".css")) {
response.setContentType("text/css");
response.setCharacterEncoding("UTF-8");
} else if (uri.endsWith(".png")) {
response.setContentType("image/png");
} else if (uri.endsWith(".gif")) {
@@ -20,6 +23,14 @@ if (uri.endsWith(".css")) {
response.setContentType("image/x-icon");
} else if (uri.endsWith(".svg")) {
response.setContentType("image/svg+xml");
} else if (uri.endsWith(".html")) {
// /javadoc/
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
} else if (uri.endsWith(".js")) {
// /javadoc/
response.setContentType("application/x-javascript");
response.setCharacterEncoding("UTF-8");
}
response.setHeader("Accept-Ranges", "none");
response.setHeader("X-Content-Type-Options", "nosniff");