package org.kantega.revoc.web; import org.eclipse.jetty.server.Server; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.util.Timer; import java.util.TimerTask; /** * */ public class FinishedServlet extends HttpServlet { private final Server server; public FinishedServlet(Server server) { this.server = server; } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { new Timer(true).schedule(new TimerTask() { @Override public void run() { try { server.stop(); } catch (Exception e) { e.printStackTrace(); } } }, 100); } }