costin 01/08/02 19:47:32
Modified: src/share/org/apache/tomcat/core Handler.java
Log:
Added explicit setContextManager() ( to prevent eventual NPE ).
Empty init/destroy ( most internal handlers don't need that, but it's better to
avoid future class loader problems )
Invoke() is documented as the prefered method for handlers, but it was broken. Now
it works.
Added the simpler get/setNote with "real" name instead of name id. Slower but
simpler,
shouldn't be used in the critical path.
Revision Changes Path
1.40 +25 -1 jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Handler.java 2001/02/27 16:24:22 1.39
+++ Handler.java 2001/08/03 02:47:32 1.40
@@ -154,6 +154,12 @@
logger=module.getLog();
}
+ public void setContextManager( ContextManager cm ) {
+ this.contextM=cm;
+ if( logger==null )
+ logger=cm.getLog();
+ }
+
public BaseInterceptor getModule() {
return module;
}
@@ -195,6 +201,12 @@
// -------------------- Methods --------------------
+ public void init() throws TomcatException {
+ }
+
+ public void destroy() throws TomcatException {
+ }
+
/** Call the service method, and notify all listeners
*
* @exception Exception if an error happens during handling of
@@ -220,7 +232,7 @@
Exception serviceException=null;
try {
- doService( req, res );
+ invoke( req, res );
} catch( Exception ex ) {
// save error state on request and response
serviceException=ex;
@@ -343,6 +355,18 @@
public final Object getNote( int pos ) {
return notes[pos];
+ }
+
+ public Object getNote( String name ) throws TomcatException {
+ int id=contextM.getNoteId( ContextManager.HANDLER_NOTE,
+ name );
+ return getNote( id );
+ }
+
+ public void setNote( String name, Object value ) throws TomcatException {
+ int id=contextM.getNoteId( ContextManager.HANDLER_NOTE,
+ name );
+ setNote( id, value );
}
}