HandlerDispatchpublic class HandlerDispatch extends org.apache.jk.core.JkHandler Dispatch based on the message type. ( XXX make it more generic,
now it's specific to ajp13 ). |
Fields Summary |
---|
private static org.apache.juli.logging.Log | log | org.apache.jk.core.JkHandler[] | handlers | String[] | handlerNames | static final int | MAX_HANDLERS | static final int | RESERVED | int | currentId |
Constructors Summary |
---|
public HandlerDispatch()
|
Methods Summary |
---|
public void | init()
| public int | invoke(org.apache.jk.core.Msg msg, org.apache.jk.core.MsgContext ep)
int type=msg.peekByte();
ep.setType( type );
if( type > handlers.length ||
handlers[type]==null ) {
if( log.isDebugEnabled() )
log.debug( "Invalid handler " + type );
return ERROR;
}
if( log.isDebugEnabled() )
log.debug( "Received " + type + " " + handlers[type].getName());
JkHandler handler=handlers[type];
return handler.invoke( msg, ep );
| public int | registerMessageType(int id, java.lang.String name, org.apache.jk.core.JkHandler h, java.lang.String[] sig)
if( log.isDebugEnabled() )
log.debug( "Register message " + id + " " + h.getName() +
" " + h.getClass().getName());
if( id < 0 ) {
// try to find it by name
for( int i=0; i< handlerNames.length; i++ ) {
if( handlerNames[i]==null ) continue;
if( name.equals( handlerNames[i] ) )
return i;
}
handlers[currentId]=h;
handlerNames[currentId]=name;
currentId++;
return currentId;
}
handlers[id]=h;
handlerNames[currentId]=name;
return id;
|
|