public BaseMethodBinding < ? > determineResourceMethod ( RequestDetails requestDetails , String requestPath ) { RequestTypeEnum requestType = requestDetails . getRequestType ( ) ; ResourceBinding resourceBinding = null ; BaseMethodBinding < ? > resourceMethod = null ; String resourceName = requestDetails . getResourceName ( ) ; if ( myServerConformanceMethod . incomingServerRequestMatchesMethod ( requestDetails ) ) { resourceMethod = myServerConformanceMethod ; } else if ( resourceName == null ) { resourceBinding = myServerBinding ; } else { resourceBinding = myResourceNameToBinding . get ( resourceName ) ; if ( resourceBinding == null ) { throwUnknownResourceTypeException ( resourceName ) ; } } if ( resourceMethod == null ) { if ( resourceBinding != null ) { resourceMethod = resourceBinding . getMethod ( requestDetails ) ; } if ( resourceMethod == null ) { resourceMethod = myGlobalBinding . getMethod ( requestDetails ) ; } } if ( resourceMethod == null ) { if ( isBlank ( requestPath ) ) { throw new InvalidRequestException ( myFhirContext . getLocalizer ( ) . getMessage ( RestfulServer . class , "rootRequest" ) ) ; } throwUnknownFhirOperationException ( requestDetails , requestPath , requestType ) ; } return resourceMethod ; }
Figure out and return whichever method binding is appropriate for the given request