You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2001/06/18 21:33:40 UTC

cvs commit: xml-axis/java/webapps/axis/WEB-INF web.xml

gdaniels    01/06/18 12:33:39

  Modified:    java     build.xml
               java/samples/transport FileReader.java
               java/webapps/axis index.html
               java/webapps/axis/WEB-INF web.xml
  Added:       java/src/org/apache/axis/transport/http AdminServlet.java
  Log:
  First cut at a tiny web management interface for Axis.
  
  Add an AdminServlet which manages a singleton AxisServer instance.
  Right now you can only turn it on and off, but if you do so you can see
  the appropriate fault come back when its disabled.
  
  Revision  Changes    Path
  1.25      +1 -3      xml-axis/java/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/build.xml,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- build.xml	2001/06/05 11:59:14	1.24
  +++ build.xml	2001/06/18 19:33:17	1.25
  @@ -135,6 +135,7 @@
         deprecation="${deprecation}"
         classpathref="classpath">
         <exclude name="**/old/**/*" />
  +      <exclude name="**/bak/**"/>
         <exclude name="org/apache/axis/handlers/HTTP*" unless="servlet.present"/>
         <exclude name="org/apache/axis/transport/http/*" unless="servlet.present"/>
       </javac>
  @@ -161,9 +162,6 @@
         <exclude name="samples/**/*SMTP*.java" unless="smtp.present" />
         <exclude name="**/old/**/*.java" />
       </javac>
  -    <copy todir="${build.samples}">
  -      <fileset dir="${samples.dir}"/>
  -    </copy>
     </target>
   
     <!-- =================================================================== -->
  
  
  
  1.11      +2 -0      xml-axis/java/samples/transport/FileReader.java
  
  Index: FileReader.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/FileReader.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FileReader.java	2001/06/15 00:02:58	1.10
  +++ FileReader.java	2001/06/18 19:33:21	1.11
  @@ -108,8 +108,10 @@
               msg = msgContext.getResponseMessage();
           } catch (AxisFault af) {
               msg = new Message(af);
  +            msg.setMessageContext(msgContext);
           } catch (Exception e) {
               msg = new Message(new AxisFault(e.toString()));
  +            msg.setMessageContext(msgContext);
           }
           
           buf = (byte[]) msg.getAsBytes();
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/http/AdminServlet.java
  
  Index: AdminServlet.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.http ;
  
  import java.io.*;
  import javax.servlet.* ;
  import javax.servlet.http.* ;
  import org.apache.axis.* ;
  import org.apache.axis.server.* ;
  import org.apache.axis.utils.* ;
  
  /**
   * 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@macromedia.com)
   */
  public class AdminServlet extends HttpServlet {
    private AxisServer server;
    
    public void init() {
        server = AxisServer.getSingleton();
    }
  
    public void doGet(HttpServletRequest req, HttpServletResponse res)
                  throws ServletException, IOException {
      res.setContentType("text/html");
      String str = "";
      
      String cmd = req.getParameter("cmd");
      if (cmd != null) {
          if (cmd.equals("start"))
              server.start();
          else
              server.stop();
      }
  
      str += "Server is " + (server.isRunning() ? "running" : "stopped");
      str += "<p><a href=\"?cmd=start\">start server</a>";
      str += "<p><a href=\"?cmd=stop\">stop server</a>";
      res.getWriter().println( str );
    }
  }
  
  
  
  1.2       +1 -0      xml-axis/java/webapps/axis/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/webapps/axis/index.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- index.html	2001/01/23 14:44:29	1.1
  +++ index.html	2001/06/18 19:33:29	1.2
  @@ -16,6 +16,7 @@
   <p>What do you want to do today?</p>
   
   <ul>
  +    <li><a href="servlet/AdminServlet">Administer Axis</a></li>
       <li><a href="servlet/AxisServlet">Visit</a> the Axis Servlet</li>
   </ul>
   </body>
  
  
  
  1.4       +14 -0     xml-axis/java/webapps/axis/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/webapps/axis/WEB-INF/web.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- web.xml	2001/02/20 14:24:57	1.3
  +++ web.xml	2001/06/18 19:33:36	1.4
  @@ -20,4 +20,18 @@
       <url-pattern>*.jws</url-pattern>
     </servlet-mapping>
   
  +  <servlet>
  +    <servlet-name>AdminServlet</servlet-name>
  +    <load-on-startup>100</load-on-startup>
  +    <display-name>Axis Admin Servlet</display-name>
  +    <servlet-class>
  +        org.apache.axis.transport.http.AdminServlet
  +    </servlet-class>
  +  </servlet>
  +
  +  <servlet-mapping>
  +    <servlet-name>AdminServlet</servlet-name>
  +    <url-pattern>servlet/AdminServlet</url-pattern>
  +  </servlet-mapping>
  +
   </web-app>