1 55 56 package org.jboss.axis.transport.http; 57 58 import org.jboss.axis.server.AxisServer; 59 import org.jboss.axis.utils.Messages; 60 import org.jboss.logging.Logger; 61 62 import javax.servlet.ServletException ; 63 import javax.servlet.http.HttpServletRequest ; 64 import javax.servlet.http.HttpServletResponse ; 65 import java.io.IOException ; 66 67 80 public class AdminServlet extends AxisServletBase 81 { 82 83 private static Logger log = Logger.getLogger(AxisServlet.class.getName()); 84 85 86 94 public void doGet(HttpServletRequest request, HttpServletResponse response) 95 throws ServletException , IOException 96 { 97 response.setContentType("text/html"); 98 StringBuffer buffer = new StringBuffer (512); 99 buffer.append("<html><head><title>Axis</title></head><body>\n"); 100 AxisServer server = getEngine(); 102 103 String cmd = request.getParameter("cmd"); 105 if (cmd != null) 106 { 107 String callerIP = request.getRemoteAddr(); 109 if (isDevelopment()) 110 { 111 if (cmd.equals("start")) 113 { 114 log.info(Messages.getMessage("adminServiceStart", callerIP)); 115 server.start(); 116 } 117 else if (cmd.equals("stop")) 118 { 119 log.info(Messages.getMessage("adminServiceStop", callerIP)); 120 server.stop(); 121 } 122 } 123 else 124 { 125 log.info(Messages.getMessage("adminServiceDeny", callerIP)); 128 } 129 } 130 131 if (server.isRunning()) 133 { 134 buffer.append(Messages.getMessage("serverRun00")); 135 } 136 else 137 { 138 buffer.append(Messages.getMessage("serverStop00")); 139 } 140 if (isDevelopment()) 142 { 143 buffer.append("<p><a HREF=\"AdminServlet?cmd=start\">start server</a>\n"); 144 buffer.append("<p><a HREF=\"AdminServlet?cmd=stop\">stop server</a>\n"); 145 } 146 buffer.append("<p>"); 148 buffer.append(Messages.getMessage("adminServiceLoad", 149 Integer.toString(getLoadCounter()))); 150 buffer.append("\n</body></html>\n"); 151 response.getWriter().print(new String (buffer)); 152 } 153 } 154 | Popular Tags |