1 package com.quadcap.http.server22; 2 3 40 41 import java.io.*; 42 43 import javax.servlet.*; 44 import javax.servlet.http.*; 45 46 import com.quadcap.util.Debug; 47 48 53 public class AdminServlet extends HttpServlet { 54 55 62 public void init(ServletConfig config) throws ServletException { 63 super.init(config); 64 } 65 66 77 protected void service(HttpServletRequest req, HttpServletResponse res) 78 throws ServletException, IOException 79 { 80 OutputStream os = res.getOutputStream(); 81 String method = req.getPathInfo(); 82 if (method != null && method.equals("/shutdown")) { 83 os.write("shutdown ok\r\n".getBytes()); 84 os.flush(); 85 Debug.println(0, "Shutdown"); 86 System.exit(0); 87 } else { 88 res.sendError(HttpServletResponse.SC_NOT_FOUND, 89 "Not Found"); 90 } 91 } 92 } 93 | Popular Tags |