public Runnable discriminate ( HttpInboundConnectionExtended inboundConnection ) { String requestUri = inboundConnection . getRequest ( ) . getURI ( ) ; Runnable requestHandler = null ; // Find the container that can handle this URI. // The first to return a non-null wins for ( HttpContainerContext ctx : httpContainers ) { requestHandler = ctx . container . createRunnableHandler ( inboundConnection ) ; if ( requestHandler != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { if ( ! requestUri . endsWith ( "/" ) ) { // Strip the query string and append a / to help the best match int pos = requestUri . lastIndexOf ( ' ' ) ; if ( pos >= 0 ) { requestUri = requestUri . substring ( 0 , pos ) ; } requestUri += "/" ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Discriminate " + requestUri , ctx . container ) ; } } break ; } } return requestHandler ; }
Given a new shiny inbound connection figure out which HttpContainer will handle the inbound request and return a Runnable that should be used to dispatch the work .