private void appendBundle ( JoinableResourceBundle bundle , Map < String , String > variants , StringBuffer buf , boolean useGzip ) { buf . append ( "r(" ) . append ( JavascriptStringUtil . quote ( bundle . getId ( ) ) ) . append ( "," ) ; String path = bundle . getURLPrefix ( variants ) ; if ( useGzip ) { if ( path . charAt ( 0 ) == ' ' ) { path = path . substring ( 1 ) ; // remove leading '/' } buf . append ( JavascriptStringUtil . quote ( BundleRenderer . GZIP_PATH_PREFIX + path ) ) ; } else { if ( path . charAt ( 0 ) != ' ' ) { path = "/" + path ; // Add leading '/' } buf . append ( JavascriptStringUtil . quote ( path ) ) ; } boolean skipItems = false ; if ( bundle . getItemPathList ( ) . size ( ) == 1 && null == bundle . getExplorerConditionalExpression ( ) ) { skipItems = bundle . getItemPathList ( ) . get ( 0 ) . getPath ( ) . equals ( bundle . getId ( ) ) ; } if ( ! skipItems ) { buf . append ( ",[" ) ; for ( Iterator < BundlePath > it = bundle . getItemPathList ( variants ) . iterator ( ) ; it . hasNext ( ) ; ) { path = it . next ( ) . getPath ( ) ; if ( this . config . getGeneratorRegistry ( ) . isPathGenerated ( path ) ) { path = PathNormalizer . createGenerationPath ( path , this . config . getGeneratorRegistry ( ) , null ) ; } if ( "" . equals ( this . config . getContextPathOverride ( ) ) && path . startsWith ( "/" ) ) path = path . substring ( 1 ) ; buf . append ( JavascriptStringUtil . quote ( path ) ) ; if ( it . hasNext ( ) ) buf . append ( "," ) ; } buf . append ( "]" ) ; if ( null != bundle . getExplorerConditionalExpression ( ) ) { buf . append ( ",'" ) . append ( bundle . getExplorerConditionalExpression ( ) ) . append ( "'" ) ; } } if ( null != bundle . getAlternateProductionURL ( ) ) { // Complete the parameters if needed, since the alternate param goes // afterwards if ( skipItems ) buf . append ( ",null,null" ) ; else if ( null == bundle . getExplorerConditionalExpression ( ) ) buf . append ( ",null" ) ; buf . append ( "," ) . append ( JavascriptStringUtil . quote ( bundle . getAlternateProductionURL ( ) ) ) ; } buf . append ( ")" ) ; }
Creates a javascript object that represents a bundle