public static void registerHandler ( RequestHandler handler , RequestMapper mapper ) { String name = null ; int internalPort = 8080 ; if ( handler instanceof AbstractRequestHandler ) { name = ( ( AbstractRequestHandler ) handler ) . getAccessPointPath ( ) ; internalPort = ( ( AbstractRequestHandler ) handler ) . getInternalPort ( ) ; } if ( name == null ) { name = handler . getBeanName ( ) ; if ( name != null ) { LOGGER . warning ( "Request handler with bean name " + name + " does not provide explict " + "access point path. Will try to use the beanname to infer. This fallback " + "is DEPRECATED and will be removed in the future. Please update configuration " + "to explicitly set 'accessPointPath' property (and 'internalPort' if needed)." ) ; } } if ( name != null ) { if ( name . equals ( RequestMapper . GLOBAL_PRE_REQUEST_HANDLER ) ) { LOGGER . info ( "Registering Global-pre request handler:" + handler ) ; mapper . addGlobalPreRequestHandler ( handler ) ; } else if ( name . equals ( RequestMapper . GLOBAL_POST_REQUEST_HANDLER ) ) { LOGGER . info ( "Registering Global-post request handler:" + handler ) ; mapper . addGlobalPostRequestHandler ( handler ) ; } else { try { boolean registered = registerPort ( name , handler , mapper ) || registerPortPath ( name , handler , mapper ) || registerHostPort ( name , handler , mapper ) || registerHostPortPath ( name , handler , mapper ) || registerURIPatternPath ( name , internalPort , handler , mapper ) ; if ( ! registered ) { LOGGER . severe ( "Unable to register (" + name + ")" ) ; } } catch ( NumberFormatException e ) { LOGGER . severe ( "FAILED parseInt(" + name + ")" ) ; } } } else { LOGGER . info ( "Unable to register RequestHandler - null beanName" ) ; } if ( handler instanceof ShutdownListener ) { ShutdownListener s = ( ShutdownListener ) handler ; mapper . addShutdownListener ( s ) ; } }
Extract the RequestHandler objects beanName parse it and register the RequestHandler with the RequestMapper according to the beanNames semantics .