/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.axis.transport.http ; import org.apache.axis.components.logger.LogFactory; import org.apache.axis.server.AxisServer; import org.apache.axis.utils.Messages; import org.apache.axis.AxisFault; import org.apache.axis.ConfigurationException; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.description.ServiceDesc; import org.apache.commons.logging.Log; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.namespace.QName; import java.io.IOException; import java.util.Iterator; /** * Proof-of-concept "management" servlet for Axis. * * Point a browser here to administer the Axis installation. * * Right now just starts and stops the server. * * @author Glen Daniels (gdaniels@apache.org) * @author Steve Loughran * xdoclet tags are not active yet; keep web.xml in sync * @web.servlet name="AdminServlet" display-name="Axis Admin Servlet" load-on-startup="100" * @web.servlet-mapping url-pattern="/servlet/AdminServlet" */ public class AdminServlet extends AxisServletBase { private static Log log = LogFactory.getLog(AxisServlet.class.getName()); /** * handle a GET request. Commands are only valid when not in production mode * @param request * @param response * @throws ServletException * @throws IOException */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html; charset=utf-8"); StringBuffer buffer=new StringBuffer(512); buffer.append("
start server\n"); buffer.append("
stop server\n"); Iterator i; try { i = server.getConfig().getDeployedServices(); } catch (ConfigurationException configException) { //turn any internal configuration exceptions back into axis faults //if that is what they are if(configException.getContainedException() instanceof AxisFault) { throw (AxisFault) configException.getContainedException(); } else { throw configException; } } buffer.append("
"); buffer.append(Messages.getMessage("adminServiceLoad", Integer.toString(getLoadCounter()))); buffer.append("\n\n"); response.getWriter().print( new String(buffer) ); } }