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 Mon, 18 Jun 2001 18:34:42 GMT
gdaniels    01/06/18 11:34:42

  Modified:    java/src/org/apache/axis AxisEngine.java MessageContext.java
               java/src/org/apache/axis/handlers/soap SOAPService.java
               java/src/org/apache/axis/server AxisServer.java
               java/src/org/apache/axis/transport/http AxisServlet.java
  Log:
  Start of re-factoring Transports:
  
    MessageContext gets transportName field.
  
    AxisServlet sets transportName to it's request transport ("request" +
    "response" transport names will soon go away)
  
    SOAPService now has the ability to lock out particular transports from
    accessing a service.
  
    Next step is to actually bind the transport req/resp handlers together
    into a single object, and add transport registries.
  
  Initialize registries in engine.init().
  
  AxisServlet gets its AxisServer from the getSingleton() method.
  
    NOTE: This could be changed easily to AxisServer.getServer(String transport),
    which was I believe what we originally discussed at the March F2F.  This would
    enable a configuration file / system property to decide whether to instantiate
    one AxisServer per VM, or one per transport, or whatever.
  
  Revision  Changes    Path
  1.10      +3 -4      xml-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AxisEngine.java	2001/06/18 15:43:30	1.9
  +++ AxisEngine.java	2001/06/18 18:34:21	1.10
  @@ -150,8 +150,6 @@
       public AxisEngine(HandlerRegistry handlers, HandlerRegistry services)
       {
           this();
  -        handlers.init();
  -        services.init();
           setHandlerRegistry(handlers);
           setServiceRegistry(services);
           
  @@ -170,7 +168,6 @@
           DefaultHandlerRegistry  hr =
                                       new DefaultHandlerRegistry(handlerRegFilename);
           hr.setOnServer( isOnServer() );
  -        hr.init();
           setHandlerRegistry( hr );
           
           // Load the simple deployed services registry and init it
  @@ -178,7 +175,6 @@
                                       new DefaultServiceRegistry(serviceRegFilename);
           sr.setHandlerRegistry( getHandlerRegistry() ); // needs to know about 'hr'
           sr.setOnServer( isOnServer() );
  -        sr.init();
           setServiceRegistry( sr );
           
           init();
  @@ -200,6 +196,9 @@
           String propVal = props.getProperty("debugLevel", "0");
           Debug.setDebugLevel(Integer.parseInt(propVal));
           
  +        getHandlerRegistry().init();
  +        getServiceRegistry().init();
  +
           // Load the registry of deployed types
           TypeMappingRegistry tmr = new TypeMappingRegistry("typemap-supp.reg");
           tmr.setParent(new SOAPTypeMappingRegistry());
  
  
  
  1.39      +19 -0     xml-axis/java/src/org/apache/axis/MessageContext.java
  
  Index: MessageContext.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- MessageContext.java	2001/06/15 23:16:18	1.38
  +++ MessageContext.java	2001/06/18 18:34:24	1.39
  @@ -108,6 +108,12 @@
        * to determine what to do next.
        */
       private String           targetService ;
  +    
  +    /**
  +     * The name of the Transport which this message was received on (or is
  +     * headed to, for the client).
  +     */
  +    private String           transportName;
   
       /**
        * The default classloader that this service should use
  @@ -179,6 +185,19 @@
   
       public void setServiceDescription(ServiceDescription serviceDesc) {
           this.serviceDesc = serviceDesc;
  +    }
  +    
  +    /**
  +     * Transport
  +     */
  +    public String getTransportName()
  +    {
  +        return transportName;
  +    }
  +    
  +    public void setTransportName(String transportName)
  +    {
  +        this.transportName = transportName;
       }
       
       /**
  
  
  
  1.9       +49 -1     xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
  
  Index: SOAPService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SOAPService.java	2001/06/15 23:16:21	1.8
  +++ SOAPService.java	2001/06/18 18:34:31	1.9
  @@ -54,6 +54,7 @@
   
   package org.apache.axis.handlers.soap;
   
  +import java.util.Vector;
   import org.apache.axis.*;
   import org.apache.axis.encoding.*;
   import org.apache.axis.utils.Debug;
  @@ -71,6 +72,14 @@
   public class SOAPService extends SimpleTargetedChain
   {
       public static final String OPTION_PIVOT = "pivot";
  +    
  +    /** Valid transports for this service
  +     * (server side only!)
  +     * 
  +     * !!! For now, if this is null, we assume all
  +     * transports are valid.
  +     */
  +    private Vector validTransports = null;
   
       /** Service-specific type mappings
        */
  @@ -104,11 +113,29 @@
           addOption(OPTION_PIVOT, pivotName);
       }
       
  +    public boolean availableFromTransport(String transportName)
  +    {
  +        if (validTransports != null) {
  +            for (int i = 0; i < validTransports.size(); i++) {
  +                if (((String)validTransports.elementAt(i)).
  +                                                 equals(transportName))
  +                    return true;
  +            }
  +            return false;
  +        }
  +        
  +        return true;
  +    }
  +    
       public void invoke(MessageContext msgContext) throws AxisFault
       {
           Debug.Print( 1, "Enter: SOAPService::invoke" );
           
  -        //msgContext.setServiceHandler( this );
  +        if (!availableFromTransport(msgContext.getTransportName()))
  +            throw new AxisFault("Server.NotAvailable",
  +                "This service is not available at this endpoint (" +
  +                msgContext.getTransportName() + ").",
  +                null, null);
           
           Handler h = getRequestChain() ;
           if ( h != null ) {
  @@ -188,5 +215,26 @@
       {
           typeMap.removeDeserializer(qName);
           typeMap.removeSerializer(cls);
  +    }
  +    
  +    /**
  +     * Make this service available on a particular transport
  +     */
  +    public void enableTransport(String transportName)
  +    {
  +        Debug.Print(3, "SOAPService(" + this + ") enabling transport " + transportName);
  +        if (validTransports == null)
  +            validTransports = new Vector();
  +        validTransports.addElement(transportName);
  +    }
  +    
  +    /**
  +     * Disable access to this service from a particular transport
  +     */
  +    public void disableTransport(String transportName)
  +    {
  +        if (validTransports != null) {
  +            validTransports.removeElement(transportName);
  +        }
       }
   }
  
  
  
  1.22      +2 -3      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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- AxisServer.java	2001/06/15 23:16:22	1.21
  +++ AxisServer.java	2001/06/18 18:34:34	1.22
  @@ -74,12 +74,10 @@
       /** Lifecycle routines for managing a static AxisServer
        */
       private static AxisServer singleton = null;
  -    public static AxisServer getSingleton()
  +    public static synchronized AxisServer getSingleton()
       {
           if (singleton == null) {
               singleton = new AxisServer();
  -            singleton.init();
  -            // ??? Why doesn't init just happen in the constructor?
           }
           return singleton;
       }
  @@ -95,6 +93,7 @@
        */
       public void start()
       {
  +        // re-init...
           init();
           running = true;
       }
  
  
  
  1.26      +3 -13     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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AxisServlet.java	2001/06/15 23:16:22	1.25
  +++ AxisServlet.java	2001/06/18 18:34:38	1.26
  @@ -102,19 +102,8 @@
       ServletContext context = config.getServletContext();
       HttpSession    session = req.getSession();
   
  -    AxisEngine  engine = null ;
  -
  -    /* Get or 'new' the Axis engine object */
  -    /***************************************/
  -    synchronized(context) {
  -      engine = (AxisEngine) context.getAttribute( AXIS_ENGINE );
  -      if ( engine == null ) {
  -        engine = new AxisServer();
  -        engine.init();
  -        context.setAttribute( AXIS_ENGINE, engine );
  -      }
  -    }
  -
  +    AxisEngine  engine = AxisServer.getSingleton();
  +    
       /* Place the Request message in the MessagContext object - notice */
       /* that we just leave it as a 'ServletRequest' object and let the  */
       /* Message processing routine convert it - we don't do it since we */
  @@ -133,6 +122,7 @@
       /******************************************************/
       msgContext.setProperty(MessageContext.TRANS_REQUEST , transportReqName );
       msgContext.setProperty(MessageContext.TRANS_RESPONSE, transportRespName );
  +    msgContext.setTransportName(transportReqName);
   
       /* Save some HTTP specific info in the bag in case a handler needs it */
       /**********************************************************************/
  
  
  

Mime
View raw message