mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Add HTTP headers in code server to not cache content
This commit is contained in:
parent
72275a0877
commit
05ac4b62bf
|
@ -340,6 +340,7 @@ public class CodeServlet extends HttpServlet {
|
|||
resp.setCharacterEncoding("UTF-8");
|
||||
resp.setHeader("Access-Control-Allow-Origin", "*");
|
||||
resp.setContentType(chooseContentType(fileName));
|
||||
noCache(resp);
|
||||
resp.getOutputStream().write(fileContent);
|
||||
resp.getOutputStream().flush();
|
||||
log.debug("File " + path + " served as generated file");
|
||||
|
@ -382,6 +383,7 @@ public class CodeServlet extends HttpServlet {
|
|||
resp.setStatus(HttpServletResponse.SC_OK);
|
||||
resp.setCharacterEncoding("UTF-8");
|
||||
resp.setContentType("application/javascript");
|
||||
noCache(resp);
|
||||
try (InputStream input = loader.getResourceAsStream("teavm/devserver/deobfuscator.js")) {
|
||||
IOUtils.copy(input, resp.getOutputStream());
|
||||
}
|
||||
|
@ -609,6 +611,7 @@ public class CodeServlet extends HttpServlet {
|
|||
resp.setStatus(HttpServletResponse.SC_OK);
|
||||
resp.setCharacterEncoding("UTF-8");
|
||||
resp.setContentType("text/plain");
|
||||
noCache(resp);
|
||||
IOUtils.copy(stream, resp.getOutputStream());
|
||||
resp.getOutputStream().flush();
|
||||
return true;
|
||||
|
@ -1090,4 +1093,8 @@ public class CodeServlet extends HttpServlet {
|
|||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static void noCache(HttpServletResponse response) {
|
||||
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user