How to refresh static files, like html/css in TomCat (embeded)? Without restarting server. InelliJ Idea. By using some kind of config
public class TomStart {
public static void main(String[] args) throws LifecycleException,
InterruptedException, ServletException {
Tomcat tomcat = new Tomcat();
tomcat.setPort(8082);
tomcat.addContext("/", "/web");
Context ctx = tomcat.addContext("/", new File(".").getAbsolutePath());
Tomcat.addServlet(ctx, "Embedded", new HttpServlet() {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
Writer w = resp.getWriter();
w.write("Embedded Tomcat servlet.\n");
w.flush();
w.close();
}
});
ctx.addServletMappingDecoded("/*", "Embedded");
tomcat.start();
tomcat.getServer().await();
}
}