You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/02/11 00:49:59 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/shell Startup.java

costin      00/02/10 15:49:58

  Modified:    src/share/org/apache/tomcat/context DefaultCMSetter.java
               src/share/org/apache/tomcat/core Context.java
                        ServletWrapper.java
               src/share/org/apache/tomcat/shell Startup.java
  Added:       src/share/org/apache/tomcat/core InterceptorAdapter.java
  Log:
  Added InterceptorAdapter. It will allow the use of J2EE interceptors with
  tomcat interceptors, and separation of J2ee integration code from core.
  
  The only change is that instead of adding Service and Lifecycle Interceptors
  using
  
  context.addInitInterceptor(interceptor)
  
  it need to use:
  
  InterceptorAdapter.addInitInterceptor(context, interceptor);
  
  Revision  Changes    Path
  1.8       +2 -2      jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultCMSetter.java	2000/02/10 18:55:54	1.7
  +++ DefaultCMSetter.java	2000/02/10 23:49:55	1.8
  @@ -127,8 +127,8 @@
   	//  Alternative: org.apache.tomcat.session.ServerSessionManager.getManager();
   
   	// If no ContextInterceptors are set up use defaults
  -	Enumeration enum=ctx.getContextInterceptors();
  -	if( ! enum.hasMoreElements() ) {
  +	ContextInterceptor cI[]=ctx.getContextInterceptors();
  +	if( cI.length==0 ) {
   	    // set up work dir ( attribute + creation )
   	    ctx.addContextInterceptor(new WorkDirInterceptor());
   	    
  
  
  
  1.47      +41 -74    jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- Context.java	2000/02/10 22:28:22	1.46
  +++ Context.java	2000/02/10 23:49:56	1.47
  @@ -136,6 +136,7 @@
       private RequestSecurityProvider rsProvider;
   
       private Vector contextInterceptors = new Vector();
  +    private Vector requestInterceptors = new Vector();
       
       // Servlets loaded by this context( String->ServletWrapper )
       private Hashtable servlets = new Hashtable();
  @@ -423,76 +424,6 @@
       public void setIsWARValidated(boolean isWARValidated) {
           this.isWARValidated = isWARValidated;
       }
  -
  -    
  -    /**
  -     * Adds an interceptor for init() method.
  -     * If Interceptors a, b and c are added to a context, the
  -     * implementation would guarantee the following call order:
  -     * (no matter what happens, for eg.Exceptions ??)
  -     *
  -     * <P>
  -     * <BR> a.preInvoke(...)
  -     * <BR> b.preInvoke(...)
  -     * <BR> c.preInvoke(...)
  -     * <BR> init()
  -     * <BR> c.postInvoke(...)
  -     * <BR> b.postInvoke(...)
  -     * <BR> a.postInvoke(...)
  -     */
  -    public void addInitInterceptor(LifecycleInterceptor interceptor) {
  -	initInterceptors.addElement(interceptor);
  -    }
  -
  -    /**
  -     * Adds an interceptor for destroy() method.
  -     * If Interceptors a, b and c are added to a context, the
  -     * implementation would guarantee the following call order:
  -     * (no matter what happens, for eg.Exceptions ??)
  -     *
  -     * <P>
  -     * <BR> a.preInvoke(...)
  -     * <BR> b.preInvoke(...)
  -     * <BR> c.preInvoke(...)
  -     * <BR> destroy()
  -     * <BR> c.postInvoke(...)
  -     * <BR> b.postInvoke(...)
  -     * <BR> a.postInvoke(...)
  -     */
  -    public void addDestroyInterceptor(LifecycleInterceptor interceptor) {
  -	destroyInterceptors.addElement(interceptor);
  -    }
  -
  -    /**
  -     * Adds an interceptor for service() method.
  -     * If Interceptors a, b and c are added to a context, the
  -     * implementation would guarantee the following call order:
  -     * (no matter what happens, for eg.Exceptions ??)
  -     *
  -     * <P>
  -     * <BR> a.preInvoke(...)
  -     * <BR> b.preInvoke(...)
  -     * <BR> c.preInvoke(...)
  -     * <BR> service()
  -     * <BR> c.postInvoke(...)
  -     * <BR> b.postInvoke(...)
  -     * <BR> a.postInvoke(...)
  -     */
  -    public void addServiceInterceptor(ServiceInterceptor interceptor) {
  -	serviceInterceptors.addElement(interceptor);
  -    }
  -
  -    Vector getInitInterceptors() {
  -	return initInterceptors;
  -    }
  -
  -    Vector getDestroyInterceptors() {
  -	return destroyInterceptors;
  -    }
  -
  -    Vector getServiceInterceptors() {
  -	return serviceInterceptors;
  -    }
       
       /**
        * Initializes this context to take on requests. This action
  @@ -517,9 +448,45 @@
       public void addContextInterceptor( ContextInterceptor ci) {
   	contextInterceptors.addElement( ci );
       }
  +
  +    ContextInterceptor cInterceptors[];
  +
  +    /** Return the context interceptors as an array.
  +	For performance reasons we use an array instead of
  +	returning the vector - the interceptors will not change at
  +	runtime and array access is faster and easier than vector
  +	access
  +    */
  +    public ContextInterceptor[] getContextInterceptors() {
  +	if( cInterceptors == null || cInterceptors.length != contextInterceptors.size()) {
  +	    cInterceptors=new ContextInterceptor[contextInterceptors.size()];
  +	    for( int i=0; i<cInterceptors.length; i++ ) {
  +		cInterceptors[i]=(ContextInterceptor)contextInterceptors.elementAt(i);
  +	    }
  +	}
  +	return cInterceptors;
  +    }
  +
  +    public void addRequestInterceptor( RequestInterceptor ci) {
  +	requestInterceptors.addElement( ci );
  +    }
   
  -    public Enumeration getContextInterceptors() {
  -	return contextInterceptors.elements();
  +    RequestInterceptor rInterceptors[];
  +    
  +    /** Return the context interceptors as an array.
  +	For performance reasons we use an array instead of
  +	returning the vector - the interceptors will not change at
  +	runtime and array access is faster and easier than vector
  +	access
  +    */
  +    public RequestInterceptor[] getRequestInterceptors() {
  +	if( rInterceptors == null || rInterceptors.length != requestInterceptors.size()) {
  +	    rInterceptors=new RequestInterceptor[requestInterceptors.size()];
  +	    for( int i=0; i<rInterceptors.length; i++ ) {
  +		rInterceptors[i]=(RequestInterceptor)requestInterceptors.elementAt(i);
  +	    }
  +	}
  +	return rInterceptors;
       }
   
       public SessionManager getSessionManager() {
  @@ -862,10 +829,10 @@
       }
   
       public ServletWrapper getServletMapping( String path ) {
  -	return mappings.get(path);
  +	return (ServletWrapper)mappings.get(path);
       }
   
  -    public void removeMapping( String path ) {
  +    public void removeMappingNew( String path ) {
   	log( "Removing " + path + " -> " + mappings.get(path) );
   	mappings.remove( path );
       }
  
  
  
  1.21      +81 -46    jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java
  
  Index: ServletWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ServletWrapper.java	2000/02/10 18:55:54	1.20
  +++ ServletWrapper.java	2000/02/10 23:49:57	1.21
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v 1.20 2000/02/10 18:55:54 costin Exp $
  - * $Revision: 1.20 $
  - * $Date: 2000/02/10 18:55:54 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ServletWrapper.java,v 1.21 2000/02/10 23:49:57 costin Exp $
  + * $Revision: 1.21 $
  + * $Date: 2000/02/10 23:49:57 $
    *
    * ====================================================================
    *
  @@ -190,7 +190,17 @@
       public String getSecurityRole( String name ) {
   	return (String)securityRoleRefs.get( name );
       }
  -    
  +
  +    public Servlet getServlet() {
  +	if(servlet==null) {
  +	    try {
  +		loadServlet();
  +	    } 	catch( Exception ex ) {
  +		ex.printStackTrace();
  +	    }
  +	}
  +	return servlet;
  +    }
   
       public void addInitParam( String name, String value ) {
   	if( initArgs==null) {
  @@ -448,25 +458,32 @@
       protected void handleInit(Context context, Servlet servlet, ServletConfig servletConfig )
   	throws ServletException, IOException
       {
  -	Vector v=context.getInitInterceptors();
  -	for( int i=0; i<v.size(); i++ ) {
  -	    try { 
  -		((LifecycleInterceptor)v.elementAt(i)).preInvoke( context, servlet );
  -	    } catch(InterceptorException ex ) {
  -		ex.printStackTrace();
  -	    }
  +	//	Vector v=context.getInitInterceptors();
  +	// 	for( int i=0; i<v.size(); i++ ) {
  +	// 	    try { 
  +	// 		((LifecycleInterceptor)v.elementAt(i)).preInvoke( context, servlet );
  +	// 	    } catch(InterceptorException ex ) {
  +	// 		ex.printStackTrace();
  +	// 	    }
  +	// 	}
  +	ContextInterceptor cI[]=context.getContextInterceptors();
  +	for( int i=0; i<cI.length; i++ ) {
  +	    cI[i].preServletInit( context, this ); // ignore the error - like in the original code
   	}
   	servlet.init(servletConfig);
   	// if an exception is thrown in init, no end interceptors will be called.
   	// that was in the origianl code
   
  -	for( int i=v.size()-1; i>=0 ; i-- ) {
  -	    try { 
  -		((LifecycleInterceptor)v.elementAt(i)).postInvoke( context, servlet );
  -	    } catch(InterceptorException ex ) {
  -		ex.printStackTrace();
  -	    }
  +	for( int i=cI.length-1; i>=0; i-- ) {
  +	    cI[i].postServletInit( context, this ); // ignore the error - like in the original code
   	}
  +	// 	for( int i=v.size()-1; i>=0 ; i-- ) {
  +	// 	    try { 
  +	// 		((LifecycleInterceptor)v.elementAt(i)).postInvoke( context, servlet );
  +	// 	    } catch(InterceptorException ex ) {
  +	// 		ex.printStackTrace();
  +	// 	    }
  +	// 	}
       }
   
       /** Call destroy(), with all interceptors before and after in the
  @@ -475,25 +492,32 @@
       protected void handleDestroy(Context context, Servlet servlet )
   	throws ServletException, IOException
       {
  -	Vector v=context.getDestroyInterceptors();
  -	for( int i=0; i<v.size(); i++ ) {
  -	    try { 
  -		((LifecycleInterceptor)v.elementAt(i)).preInvoke( context, servlet );
  -	    } catch(InterceptorException ex ) {
  -		ex.printStackTrace();
  -	    }
  +	// 	Vector v=context.getDestroyInterceptors();
  +	// 	for( int i=0; i<v.size(); i++ ) {
  +	// 	    try { 
  +	// 		((LifecycleInterceptor)v.elementAt(i)).preInvoke( context, servlet );
  +	// 	    } catch(InterceptorException ex ) {
  +	// 		ex.printStackTrace();
  +	// 	    }
  +	// 	}
  +	ContextInterceptor cI[]=context.getContextInterceptors();
  +	for( int i=0; i<cI.length; i++ ) {
  +	    cI[i].preServletDestroy( context, this ); // ignore the error - like in the original code
   	}
   	servlet.destroy();
  +	for( int i=cI.length-1; i>=0; i-- ) {
  +	    cI[i].postServletDestroy( context, this ); // ignore the error - like in the original code
  +	}
   	// if an exception is thrown in init, no end interceptors will be called.
   	// that was in the origianl code
   
  -	for( int i=v.size()-1; i>=0 ; i-- ) {
  -	    try { 
  -		((LifecycleInterceptor)v.elementAt(i)).postInvoke( context, servlet );
  -	    } catch(InterceptorException ex ) {
  -		ex.printStackTrace();
  -	    }
  -	}
  +	// 	for( int i=v.size()-1; i>=0 ; i-- ) {
  +	// 	    try { 
  +	// 		((LifecycleInterceptor)v.elementAt(i)).postInvoke( context, servlet );
  +	// 	    } catch(InterceptorException ex ) {
  +	// 		ex.printStackTrace();
  +	// 	    }
  +	// 	}
       }
       
   
  @@ -504,15 +528,23 @@
   				  HttpServletRequestFacade request, HttpServletResponseFacade response )
   	throws ServletException, IOException
       {
  -	Vector v = context.getServiceInterceptors();
  -	for( int i=0; i<v.size(); i++ ) {
  -	    try { 
  -		((ServiceInterceptor)v.elementAt(i)).preInvoke(context, servlet,
  -								  request, response);
  -	    } catch(InterceptorException ex ) {
  -		ex.printStackTrace();
  -	    }
  +	// XXX pass Request and Response as paramters - all tomcat code use this pattern,
  +	// we need to use Facade only when we call the Servlet methods
  +	
  +	// 	Vector v = context.getServiceInterceptors();
  +	// 	for( int i=0; i<v.size(); i++ ) {
  +	// 	    try { 
  +	// 		((ServiceInterceptor)v.elementAt(i)).preInvoke(context, servlet,
  +	// 								  request, response);
  +	// 	    } catch(InterceptorException ex ) {
  +	// 		ex.printStackTrace();
  +	// 	    }
  +	// 	}
  +	RequestInterceptor cI[]=context.getRequestInterceptors();
  +	for( int i=0; i<cI.length; i++ ) {
  +	    cI[i].preService( request.getRealRequest(), response.getRealResponse() ); // ignore the error - like in the original code
   	}
  +	
   	if (servlet instanceof SingleThreadModel) {
   	    synchronized(servlet) {
   		servlet.service(request, response);
  @@ -521,14 +553,17 @@
   	    servlet.service(request, response);
   	}
   
  -	for( int i=v.size()-1; i>=0 ; i-- ) {
  -	    try { 	
  -		((ServiceInterceptor)v.elementAt(i)).postInvoke(context, servlet,
  -								  request, response);
  -	    } catch(InterceptorException ex ) {
  -		ex.printStackTrace();
  -	    }
  +	for( int i=cI.length-1; i>=0; i-- ) {
  +	    cI[i].postService( request.getRealRequest() , response.getRealResponse() ); // ignore the error - like in the original code
   	}
  +	// 	for( int i=v.size()-1; i>=0 ; i-- ) {
  +	// 	    try { 	
  +	// 		((ServiceInterceptor)v.elementAt(i)).postInvoke(context, servlet,
  +	// 								  request, response);
  +	// 	    } catch(InterceptorException ex ) {
  +	// 		ex.printStackTrace();
  +	// 	    }
  +	// 	}
       }
   
       // Fancy sync logic is to make sure that no threads are in the
  
  
  
  1.1                  jakarta-tomcat/src/share/org/apache/tomcat/core/InterceptorAdapter.java
  
  Index: InterceptorAdapter.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 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 acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", 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 names without prior written
   *    permission of the Apache Group.
   *
   * 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.core;
  import javax.servlet.Servlet;
  import org.apache.tomcat.request.*;
  import org.apache.tomcat.context.*;
  
  
  /** Plugs Lifecylce and Service interceptors into tomcat
   */
  public class InterceptorAdapter {
      /**
       * Adds an interceptor for init() method.
       * If Interceptors a, b and c are added to a context, the
       * implementation would guarantee the following call order:
       * (no matter what happens, for eg.Exceptions ??)
       *
       * <P>
       * <BR> a.preInvoke(...)
       * <BR> b.preInvoke(...)
       * <BR> c.preInvoke(...)
       * <BR> init()
       * <BR> c.postInvoke(...)
       * <BR> b.postInvoke(...)
       * <BR> a.postInvoke(...)
       */
      public static void addInitInterceptor(Context ctx, LifecycleInterceptor interceptor) {
  	ctx.addContextInterceptor( new InitInterceptorAdapter( interceptor ) );
      }
  
      /**
       * Adds an interceptor for destroy() method.
       * If Interceptors a, b and c are added to a context, the
       * implementation would guarantee the following call order:
       * (no matter what happens, for eg.Exceptions ??)
       *
       * <P>
       * <BR> a.preInvoke(...)
       * <BR> b.preInvoke(...)
       * <BR> c.preInvoke(...)
       * <BR> destroy()
       * <BR> c.postInvoke(...)
       * <BR> b.postInvoke(...)
       * <BR> a.postInvoke(...)
       */
      public  static  void addDestroyInterceptor(Context ctx, LifecycleInterceptor interceptor) {
  	ctx.addContextInterceptor( new DestroyInterceptorAdapter( interceptor ) );
      }
  
      /**
       * Adds an interceptor for service() method.
       * If Interceptors a, b and c are added to a context, the
       * implementation would guarantee the following call order:
       * (no matter what happens, for eg.Exceptions ??)
       *
       * <P>
       * <BR> a.preInvoke(...)
       * <BR> b.preInvoke(...)
       * <BR> c.preInvoke(...)
       * <BR> service()
       * <BR> c.postInvoke(...)
       * <BR> b.postInvoke(...)
       * <BR> a.postInvoke(...)
       */
      public  static void addServiceInterceptor(Context ctx, ServiceInterceptor interceptor) {
  	ctx.addRequestInterceptor( new ServiceInterceptorAdapter( interceptor ) );
      }
      
  }
  
  class InitInterceptorAdapter extends BaseContextInterceptor implements ContextInterceptor {
      LifecycleInterceptor interceptor;
      
      InitInterceptorAdapter( LifecycleInterceptor interceptor) {
  	this.interceptor=interceptor;
      }
  
      public int preServletInit(Context ctx, ServletWrapper sw ) {
  	try {
  	    interceptor.preInvoke( ctx, sw.getServlet());
  	    return 0;
  	} catch( InterceptorException ex ) {
  	    return -1; // map exceptions to error codes
  	}
      }
  
      public int postServletInit(Context ctx, ServletWrapper sw ) {
  	try {
  	    interceptor.postInvoke( ctx, sw.getServlet());
  	    return 0;
  	} catch( InterceptorException ex ) {
  	    return -1; // map exceptions to error codes
  	}
      }
      
  }
  
  class DestroyInterceptorAdapter extends BaseContextInterceptor implements ContextInterceptor {
      LifecycleInterceptor interceptor;
      
      DestroyInterceptorAdapter( LifecycleInterceptor interceptor) {
  	this.interceptor=interceptor;
      }
  
  
      public int preServletDestroy(Context ctx, ServletWrapper sw ) {
  	try {
  	    interceptor.preInvoke( ctx, sw.getServlet());
  	    return 0;
  	} catch( InterceptorException ex ) {
  	    return -1; // map exceptions to error codes
  	}
      }
  
      public int postServletDestroy(Context ctx, ServletWrapper sw ) {
  	try {
  	    interceptor.postInvoke( ctx, sw.getServlet());
  	    return 0;
  	} catch( InterceptorException ex ) {
  	    return -1; // map exceptions to error codes
  	}
      }
  
  }
  
  class ServiceInterceptorAdapter extends BaseInterceptor implements RequestInterceptor {
      ServiceInterceptor interceptor;
      
      ServiceInterceptorAdapter( ServiceInterceptor interceptor) {
  	this.interceptor=interceptor;
      }
  
  
      public int preService(Request req, Response resp ) {
  	try {
  	    interceptor.preInvoke( req.getContext(), req.getWrapper().getServlet(),
  				    req.getFacade(),  resp.getFacade());
  	    return 0;
  	} catch( InterceptorException ex ) {
  	    return -1; // map exceptions to error codes
  	}
      }
  
      public int postService(Request req, Response resp ) {
  	try {
  	    interceptor.postInvoke( req.getContext(), req.getWrapper().getServlet(),
  				    req.getFacade(),  resp.getFacade());
  	    return 0;
  	} catch( InterceptorException ex ) {
  	    return -1; // map exceptions to error codes
  	}
      }
  
  }
  
  
  
  1.14      +3 -3      jakarta-tomcat/src/share/org/apache/tomcat/shell/Startup.java
  
  Index: Startup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/shell/Startup.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Startup.java	2000/01/25 01:11:55	1.13
  +++ Startup.java	2000/02/10 23:49:58	1.14
  @@ -158,12 +158,12 @@
   		// Register the global service and lifecycle interceptors
   		// with each new context
   		for (Enumeration e=contextConfig.getServiceInterceptors();e.hasMoreElements(); ) {
  -		    context.addServiceInterceptor((ServiceInterceptor)e.nextElement());
  +		    InterceptorAdapter.addServiceInterceptor(context, (ServiceInterceptor)e.nextElement());
   		}
   		for (Enumeration e=contextConfig.getLifecycleInterceptors();e.hasMoreElements(); ) {
   		    LifecycleInterceptor interceptor=(LifecycleInterceptor)e.nextElement();
  -		    context.addInitInterceptor(interceptor);
  -		    context.addDestroyInterceptor(interceptor);
  +		    InterceptorAdapter.addInitInterceptor(context, interceptor);
  +		    InterceptorAdapter.addDestroyInterceptor(context, interceptor);
   		}                 
   
   	    }