This seems to do the trick. I've tested it with the JDBCRealm
interceptor and it behaves normally (ie. JDBCRealm gets hooked back in
and it actually works after the application reload).

Any feedback before this gets committed is welcome (as in: I'd rather
not screw up TC 3.3 RC with my first commit :-)

Bojan
--- 
/home/groups/devel/jakarta/jakarta-tomcat/src/share/org/apache/tomcat/modules/mappers/ReloadInterceptor.java
        Mon Sep 17 11:51:12 2001
+++ 
+jakarta-tomcat-clean//src/share/org/apache/tomcat/modules/mappers/ReloadInterceptor.java
+    Tue Sep 25 07:18:06 2001
@@ -184,6 +184,14 @@
            ContextManager cm=ctx.getContextManager();
            
            if( fullReload ) {
+                Vector sI=new Vector();  // saved local interceptors
+                BaseInterceptor[] eI;    // all exisiting interceptors
+
+                // save the ones with the same context, they are local
+                eI=ctx.getContainer().getInterceptors();
+                for(int i=0; i < eI.length ; i++)
+                  if(ctx == eI[i].getContext()) sI.add(eI[i]);
+                
                Enumeration e;
                // Need to find all the "config" that
                // was read from server.xml.
@@ -205,6 +213,16 @@
                cm.removeContext( ctx );
 
                cm.addContext( ctx1 );
+
+                // put back saved local interceptors
+                e=sI.elements();
+                while(e.hasMoreElements()){
+                  BaseInterceptor savedI=(BaseInterceptor)e.nextElement();
+
+                  ctx1.addInterceptor(savedI);
+                  savedI.setContext(ctx1);
+                  savedI.reload(request,ctx1);
+                }
 
                ctx1.init();
 

Reply via email to