public String getFinalBundlePath ( String path , JawrConfig jawrConfig , Map < String , String > variantMap ) { String finalPath = path ; int jawrGenerationParamIdx = finalPath . indexOf ( JawrRequestHandler . GENERATION_PARAM ) ; if ( jawrGenerationParamIdx != - 1 ) { try { finalPath = URLDecoder . decode ( path , "UTF-8" ) ; } catch ( UnsupportedEncodingException neverHappens ) { /* URLEncoder:how not to use checked exceptions... */ throw new RuntimeException ( "Something went unexpectedly wrong while decoding a URL for a generator. " , neverHappens ) ; } // Remove servlet mapping if it exists. finalPath = removeServletMappingFromPath ( finalPath , jawrConfig . getServletMapping ( ) ) ; finalPath = jawrConfig . getGeneratorRegistry ( ) . getDebugModeBuildTimeGenerationPath ( finalPath ) ; } else { // Remove servlet mapping if it exists. finalPath = removeServletMappingFromPath ( finalPath , jawrConfig . getServletMapping ( ) ) ; if ( finalPath . startsWith ( "/" ) ) { finalPath = finalPath . substring ( 1 ) ; } // remove cache prefix, when not in debug mode if ( ! jawrConfig . isDebugModeOn ( ) ) { int idx = finalPath . indexOf ( "/" ) ; finalPath = finalPath . substring ( idx + 1 ) ; } // For localized bundle add the local info in the file name // For example, with local variant = 'en' // /bundle/myBundle.js -> /bundle/myBundle_en.js finalPath = VariantUtils . getVariantBundleName ( finalPath , variantMap , false ) ; } return finalPath ; }
Retrieves the final path where the servlet mapping and the cache prefix have been removed and take also in account the jawr generator URLs .