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/09/26 03:00:07 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Container.java
costin 00/09/25 18:00:07
Modified: src/share/org/apache/tomcat/core Container.java
Log:
Fix for hooks - each hook was added twice for defautContainer ( once
as global and once as local )
Revision Changes Path
1.32 +23 -8 jakarta-tomcat/src/share/org/apache/tomcat/core/Container.java
Index: Container.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Container.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Container.java 2000/09/23 18:39:47 1.31
+++ Container.java 2000/09/26 01:00:07 1.32
@@ -387,6 +387,7 @@
if( bi.hasHook( PREDEFINED_I[i] )) {
if( interceptors[i]==null )
interceptors[i]=new Vector();
+ if( dL > 0 ) debug( "Adding " + PREDEFINED_I[i] + " " +bi );
interceptors[i].addElement( bi );
}
}
@@ -401,39 +402,45 @@
public static int getHookId( String hookName ) {
for( int i=0; i< PREDEFINED_I.length; i++ ) {
- if( PREDEFINED_I[i].equals(hookName)){
+ if( PREDEFINED_I[i].equals(hookName))
return i;
- }
+
}
// get all interceptors for unknown hook names
return PREDEFINED_I.length-1;
}
- public BaseInterceptor[] getInterceptors( int type ) {
+ public BaseInterceptor[] getInterceptors( int type )
+ {
if( hooks[type] != null ) {
return hooks[type];
}
+ if( dL>0 )
+ debug("create hooks for " + type + " " + PREDEFINED_I[type]);
+
Container globalIntContainer=getContextManager().getContainer();
Vector globals=globalIntContainer.getLocalInterceptors( type );
- Vector locals=this.getLocalInterceptors( type );
+ Vector locals=null;
+ if( this != globalIntContainer ) {
+ locals=this.getLocalInterceptors( type );
+ }
int gsize=globals.size();
- int lsize=locals.size();
+ int lsize=(locals==null) ? 0 : locals.size();
hooks[type]=new BaseInterceptor[gsize+lsize];
for ( int i = 0 ; i < gsize ; i++ ){
hooks[type][i]=(BaseInterceptor)globals.elementAt(i);
+ if( dL > 0 ) debug( "Add " + i + " " + hooks[type][i]);
}
for ( int i = 0 ; i < lsize ; i++ ){
hooks[type][gsize+i]=(BaseInterceptor)locals.elementAt(i);
+ if( dL > 0 ) debug( "Add " + i + " " + hooks[type][i+gsize]);
}
return hooks[type];
}
-
-
-
// -------------------- Old code handling interceptors
// DEPRECATED ( after the new code is tested )
@@ -567,4 +574,12 @@
}
return rCachedContextInterceptors;
}
+
+ // debug
+ public static final int dL=0;
+ private void debug( String s ) {
+ System.out.println("Container: " + s );
+ }
+
+
}