axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/transport/http AxisServlet.java
Date Tue, 22 May 2001 05:25:35 GMT
gdaniels    01/05/21 22:25:35

  Modified:    java/src/org/apache/axis/handlers DebugHandler.java
               java/src/org/apache/axis/server AxisServer.java
               java/src/org/apache/axis/transport/http AxisServlet.java
  Added:       java/src/org/apache/axis/handlers LogMessage.java
               java/src/org/apache/axis/handlers/http URLMapper.java
  Log:
  Some cleanup and a little new stuff.
  
  DebugHandler:
     Clean up old code.
  
  AxisServer:
      Use a different exception for missing service name, as
      opposed to couldn't find service in registry.
  
  AxisServlet:
      Try servlet initParameters first, then context.  This allows
      for individual servlets in the same webapp to be different
      Axis transports.
  
  LogMessage handler:
      A trivial handler which just "marks" some custom message
      when it is invoked.  Primarily for testing and debugging.
  
  URLMapper handler:
      Assume the target service name is the pathInfo of the servlet
      request, so if you had a servlet at http://foo.com/axis, and called
      http://foo.com/axis/AdminService, you'd get the admin.
  
  Revision  Changes    Path
  1.12      +0 -20     xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java
  
  Index: DebugHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DebugHandler.java	2001/04/26 23:07:04	1.11
  +++ DebugHandler.java	2001/05/22 05:25:34	1.12
  @@ -84,26 +84,6 @@
                   Debug.setDebugLevel(debugVal);
                   header.setProcessed(true);
               }
  -            /*
  -            SOAPEnvelope  env = (SOAPEnvelope) msg.getAs( "SOAPEnvelope" );
  -            Vector        headers = null ;
  -            int           i ;
  -            
  -            headers = env.getHeadersByNameAndURI("Debug", Constants.URI_DEBUG);
  -
  -            for ( i = 0 ; headers != null && i < headers.size() ; i ++ ) {
  -                SOAPHeader  header = (SOAPHeader) headers.get(i);
  -                Element     root   = header.getRoot();
  -                String      value = root.getFirstChild().getNodeValue();
  -                if ( value != null ) {
  -                    int     debugVal = Integer.parseInt( value );
  -                    Debug.setDebugLevel( debugVal );
  -                    header.setProcessed( true );
  -                }
  -            }
  -            if ( i == 0 )
  -              Debug.setDebugLevel( 0 );
  -            */
           }
           catch( Exception e ) {
               Debug.Print( 1, e );
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/handlers/LogMessage.java
  
  Index: LogMessage.java
  ===================================================================
  package org.apache.axis.handlers;
  
  /*
   * 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/>.
   */
  
  import org.apache.axis.* ;
  import org.apache.axis.utils.* ;
  
  /** This handler simply prints a custom message to the debug log.
   *
   * @author Glen Daniels (gdaniels@macromedia.com)
   */
  public class LogMessage extends BasicHandler
  {
    public void invoke(MessageContext context)
    {
      String msg = (String)getOption("message");
      if (msg != null)
        Debug.Print(0, msg);
    }
   
    public void undo(MessageContext msgContext) {
      Debug.Print( 1, "Enter: URLMapper::undo" );
      Debug.Print( 1, "Exit: URLMapper::undo" );
    }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/handlers/http/URLMapper.java
  
  Index: URLMapper.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.handlers.http;
  
  import org.apache.axis.*;
  import org.apache.axis.handlers.BasicHandler;
  import org.apache.axis.utils.Debug;
  import org.apache.axis.transport.http.HTTPConstants;
  
  import javax.servlet.http.* ;
  
  /** An <code>URLMapper</code> attempts to use the extra path info
   * of this request as the service name.
   * 
   * @author Glen Daniels (gdaniels@macromedia.com)
   */
  public class URLMapper extends BasicHandler
  {
      public void invoke(MessageContext msgContext) throws AxisFault
      {
          Debug.Print( 1, "Enter: URLMapper::invoke" );
  
          /** If there's already a targetService (ie. JWSProcessor) then
           *  just return.
           */
          if ( msgContext.getTargetService() == null ) {
              HttpServletRequest req = (HttpServletRequest) msgContext.getProperty(
                                                HTTPConstants.MC_HTTP_SERVLETREQUEST);
              
              // Assumes "/" + servicename
              String path = req.getPathInfo().substring(1);
      
              msgContext.setTargetService( path );
          }
  
          Debug.Print( 1, "Exit : URLMapper::invoke" );
      }
  
      public void undo(MessageContext msgContext) 
      {
          Debug.Print( 1, "Enter: URLMapper::undo" );
          Debug.Print( 1, "Exit: URLMapper::undo" );
      }
  }
  
  
  
  1.8       +10 -4     xml-axis/java/src/org/apache/axis/server/AxisServer.java
  
  Index: AxisServer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/AxisServer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AxisServer.java	2001/05/21 21:03:47	1.7
  +++ AxisServer.java	2001/05/22 05:25:35	1.8
  @@ -213,12 +213,18 @@
                                        null, null );
                 */
                 hName = msgContext.getTargetService();
  -              if ( hName != null && (h = hr.find( hName )) != null )
  -                h.invoke(msgContext);
  -              else
  -                throw new AxisFault( "Server.error",
  +              if ( hName != null ) {
  +                if ((h = hr.find( hName )) != null)
  +                  h.invoke(msgContext);
  +                else
  +                  throw new AxisFault( "Server.error",
                                        "Can't find '" + hName + "' handler", 
                                        null, null );
  +              } else {
  +                throw new AxisFault("Server.NoService", 
  +                                    "The Axis engine couldn't find a target service to
invoke!",
  +                                    null, null );
  +              }
         
                 /* Process the Global Output Chain */
                 /***********************************/
  
  
  
  1.19      +8 -2      xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AxisServlet.java	2001/05/03 19:42:31	1.18
  +++ AxisServlet.java	2001/05/22 05:25:35	1.19
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -74,11 +74,17 @@
     private static final String AXIS_ENGINE = "AxisEngine" ;
   
     public void init() {
  +      String param = getInitParameter("transport.input");
         ServletContext context = getServletConfig().getServletContext();
  -      String param = context.getInitParameter("transport.input");
  +
  +      if (param == null)
  +          param = context.getInitParameter("transport.input");
         if (param != null)
             transportInName = param;
  +      
         param = getInitParameter("transport.output");
  +      if (param == null)
  +          param = context.getInitParameter("transport.output");
         if (param != null)
             transportOutName = param;
     }
  
  
  

Mime
View raw message