idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
2,600 | protected void addModuleArg ( String jsFile , String moduleName , List < String > args , StringBuilder moduleArg ) { int argIdx = 0 ; for ( Iterator < String > iterArg = args . iterator ( ) ; iterArg . hasNext ( ) ; argIdx ++ ) { String arg = iterArg . next ( ) ; if ( arg . equals ( JS_ARG ) ) { iterArg . next ( ) ; ar... | Adds the module argument taking in account the module dependencies |
2,601 | private Set < String > getClosureModuleDependencies ( JoinableResourceBundle bundle , List < String > dependencies ) { Set < String > bundleDependencies = new HashSet < > ( ) ; if ( bundle . getDependencies ( ) != null ) { for ( JoinableResourceBundle depBundle : bundle . getDependencies ( ) ) { bundleDependencies . ad... | Returns the module bundle dependency from the bundle dependency and the declared dependencies |
2,602 | private void checkBundleName ( String bundleName , Map < String , JoinableResourceBundle > bundleMap ) { if ( ! JAWR_ROOT_MODULE_NAME . equals ( bundleName ) ) { boolean moduleExist = bundleMap . get ( bundleName ) != null ; if ( ! moduleExist ) { throw new BundlingProcessException ( "The bundle name '" + bundleName + ... | Checks the bundle name |
2,603 | public static void copy ( InputStream input , Writer writer ) throws IOException { copy ( new InputStreamReader ( input ) , writer ) ; } | Writes all the contents of an InputStream to a Writer . |
2,604 | public static void copy ( InputStream input , OutputStream output , boolean closeStreams ) throws IOException { try { copy ( input , output ) ; } finally { if ( closeStreams ) { close ( input ) ; close ( output ) ; } } } | Writes all the contents of an InputStream to an OutputStream . |
2,605 | public static void write ( byte [ ] byteArray , OutputStream out ) throws IOException { if ( byteArray != null ) { out . write ( byteArray ) ; } } | Writes all the contents of a byte array to an OutputStream . |
2,606 | public static void copy ( ReadableByteChannel inChannel , WritableByteChannel outChannel ) throws IOException { if ( inChannel instanceof FileChannel ) { ( ( FileChannel ) inChannel ) . transferTo ( 0 , ( ( FileChannel ) inChannel ) . size ( ) , outChannel ) ; } else { final ByteBuffer buffer = ByteBuffer . allocateDir... | Copy the readable byte channel to the writable byte channel |
2,607 | public String getId ( ) { StringBuilder strId = new StringBuilder ( ) ; strId . append ( id ) ; if ( nextProcessor != null ) { strId . append ( "," ) . append ( nextProcessor . getId ( ) ) ; } return strId . toString ( ) ; } | Returns the ID of the ChainedResourceBundlePostProcessor |
2,608 | public void addNextProcessor ( ChainedResourceBundlePostProcessor nextProcessor ) { if ( ! isVariantPostProcessor ) { isVariantPostProcessor = nextProcessor . isVariantPostProcessor ( ) ; } if ( this . nextProcessor == null ) { this . nextProcessor = nextProcessor ; } else { this . nextProcessor . addNextProcessor ( ne... | Set the next post processor in the chain . |
2,609 | public static String [ ] extractBinaryResourceInfo ( String path ) { String [ ] resourceInfo = new String [ 2 ] ; String resourcePath = path ; if ( resourcePath . startsWith ( JawrConstant . URL_SEPARATOR ) ) { resourcePath = resourcePath . substring ( 1 ) ; } Matcher matcher = CACHE_BUSTER_PATTERN . matcher ( resource... | Returns the binary resource info from the path |
2,610 | public static String normalizePathMapping ( String pathMapping ) { String normalizedPathMapping = normalizePath ( pathMapping ) ; if ( normalizedPathMapping . endsWith ( "/**" ) ) normalizedPathMapping = normalizedPathMapping . substring ( 0 , normalizedPathMapping . length ( ) - 3 ) ; return normalizedPathMapping ; } | Normalizes a bundle path mapping . If it ends with a wildcard the wildcard is removed . |
2,611 | public static String asDirPath ( String path ) { String dirPath = path ; if ( ! path . equals ( JawrConstant . URL_SEPARATOR ) ) { dirPath = JawrConstant . URL_SEPARATOR + normalizePath ( path ) + JawrConstant . URL_SEPARATOR ; } return dirPath ; } | Normalizes a path and adds a separator at its start and its end . |
2,612 | public static String joinDomainToPath ( String domainName , String path ) { StringBuilder sb = new StringBuilder ( ) ; if ( domainName . endsWith ( JawrConstant . URL_SEPARATOR ) ) { sb . append ( domainName . substring ( 0 , domainName . length ( ) - 1 ) ) ; } else { sb . append ( domainName ) ; } sb . append ( JawrCo... | Normalizes a domain name and a path and joins them as a single url . |
2,613 | public static final Set < String > normalizePaths ( Set < String > paths ) { Set < String > ret = new HashSet < > ( ) ; for ( Iterator < String > it = paths . iterator ( ) ; it . hasNext ( ) ; ) { String path = normalizePath ( ( String ) it . next ( ) ) ; ret . add ( path ) ; } return ret ; } | Normalizes all the paths in a Set . |
2,614 | public static String addGetParameter ( String path , String parameterKey , String parameter ) { StringBuilder sb = new StringBuilder ( path ) ; if ( path . indexOf ( "?" ) > 0 ) { sb . append ( "&" ) ; } else { sb . append ( "?" ) ; } sb . append ( parameterKey ) . append ( "=" ) . append ( parameter ) ; return sb . to... | Adds a key and value to the request path & or ? will be used as needed |
2,615 | public static String getParentPath ( String path ) { String parentPath = null ; if ( StringUtils . isEmpty ( path ) ) { parentPath = "" ; } else { parentPath = path ; if ( parentPath . length ( ) > 1 && parentPath . endsWith ( JawrConstant . URL_SEPARATOR ) ) { parentPath = parentPath . substring ( 0 , parentPath . len... | Determines the parent path of a filename or a directory . |
2,616 | public static String getPathName ( String path ) { String pathName = null ; if ( StringUtils . isEmpty ( path ) ) { pathName = "" ; } else { pathName = path ; if ( pathName . length ( ) > 1 && pathName . endsWith ( JawrConstant . URL_SEPARATOR ) ) { pathName = pathName . substring ( 0 , pathName . length ( ) - 1 ) ; } ... | Determines the filename of a path . |
2,617 | static final String uppercaseDrive ( String path ) { String resultPath = null ; if ( path != null ) { if ( path . length ( ) >= 2 && path . charAt ( 1 ) == ':' ) { resultPath = Character . toUpperCase ( path . charAt ( 0 ) ) + path . substring ( 1 ) ; } else { resultPath = path ; } } return resultPath ; } | Cygwin prefers lowercase drive letters but other parts of maven use uppercase |
2,618 | public String getCommonProperty ( String key , String defaultValue ) { return props . getProperty ( PropertiesBundleConstant . PROPS_PREFIX + key , defaultValue ) ; } | Returns the value of the common property or the default value if no value is defined instead . |
2,619 | public String getCustomBundleProperty ( String bundleName , String key , String defaultValue ) { return props . getProperty ( prefix + PropertiesBundleConstant . BUNDLE_FACTORY_CUSTOM_PROPERTY + bundleName + key , defaultValue ) ; } | Returns the value of the custom bundle property or the default value if no value is defined |
2,620 | public List < String > getCustomBundlePropertyAsList ( String bundleName , String key ) { List < String > propertiesList = new ArrayList < > ( ) ; StringTokenizer tk = new StringTokenizer ( getCustomBundleProperty ( bundleName , key , "" ) , "," ) ; while ( tk . hasMoreTokens ( ) ) propertiesList . add ( tk . nextToken... | Returns as a list the comma separated values of a property |
2,621 | public Map < String , VariantSet > getCustomBundleVariantSets ( String bundleName ) { Map < String , VariantSet > variantSets = new HashMap < > ( ) ; StringTokenizer tk = new StringTokenizer ( getCustomBundleProperty ( bundleName , PropertiesBundleConstant . BUNDLE_FACTORY_CUSTOM_VARIANTS , "" ) , ";" ) ; while ( tk . ... | Returns the map of variantSet for the bundle |
2,622 | public String getProperty ( String key , String defaultValue ) { return props . getProperty ( prefix + key , defaultValue ) ; } | Returns the value of a property or the default value if no value is defined |
2,623 | public Set < String > getPropertyBundleNameSet ( ) { Set < String > bundleNameSet = new HashSet < > ( ) ; for ( Object key : props . keySet ( ) ) { Matcher matcher = bundleNamePattern . matcher ( ( String ) key ) ; if ( matcher . matches ( ) ) { String id = matcher . group ( 2 ) ; bundleNameSet . add ( id ) ; } } retur... | Returns the set of names for the bundles |
2,624 | private Map < String , String > getCustomMap ( Pattern keyPattern ) { Map < String , String > map = new HashMap < > ( ) ; for ( Iterator < Object > it = props . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { String key = ( String ) it . next ( ) ; Matcher matcher = keyPattern . matcher ( key ) ; if ( matcher . matc... | Returns the map where the key is the 2 group of the pattern and the value is the property value |
2,625 | public Locale getFallbackLocale ( ) { Locale locale = null ; if ( this . fallbackToSystemLocale ) { locale = Locale . getDefault ( ) ; } else { locale = new Locale ( "" , "" ) ; } return locale ; } | Returns the fall - back locale |
2,626 | private void initialize ( JawrConfig config ) { StopWatch stopWatch = new StopWatch ( "Initializing JS engine for Autoprefixer" ) ; stopWatch . start ( ) ; String script = config . getProperty ( AUTOPREFIXER_SCRIPT_LOCATION , AUTOPREFIXER_SCRIPT_DEFAULT_LOCATION ) ; String jsEngineName = config . getJavascriptEngineNam... | Initialize the postprocessor |
2,627 | private String generateContent ( GeneratorContext context , ResourceBundlesHandler bundlesHandler , String bundlePath , Map < String , String > variants ) { String cssGeneratorBundlePath = PathNormalizer . joinPaths ( context . getConfig ( ) . getServletMapping ( ) , ResourceGenerator . CSS_DEBUGPATH ) ; JoinableResour... | Generates the Css content for the bundle path |
2,628 | private Map < String , String > getVariantMap ( ResourceBundlesHandler bundlesHandler , String contextPath , String bundlePath ) { JoinableResourceBundle bundle = bundlesHandler . resolveBundleForPath ( bundlePath ) ; Set < String > variantTypes = bundle . getVariants ( ) . keySet ( ) ; String variantKey = getVariantKe... | Returns the variant map from the context path |
2,629 | private String getBundlePath ( String contextPath ) { String bundlePath = contextPath ; int idx = - 1 ; if ( bundlePath . startsWith ( JawrConstant . URL_SEPARATOR ) ) { idx = bundlePath . indexOf ( JawrConstant . URL_SEPARATOR , 1 ) ; } else { idx = bundlePath . indexOf ( JawrConstant . URL_SEPARATOR , 1 ) ; } if ( id... | Returns the IE Css bundle path from the context path |
2,630 | private String getVariantKey ( String contextPath ) { String resultPath = contextPath . substring ( 1 ) ; String variantKey = "" ; String prefix = resultPath . substring ( 0 , resultPath . indexOf ( JawrConstant . URL_SEPARATOR ) ) ; if ( prefix . indexOf ( '.' ) != - 1 ) { variantKey = prefix . substring ( prefix . in... | Returns the variant key from the context path . |
2,631 | public static BundleRendererContext getBundleRendererContext ( HttpServletRequest request , BundleRenderer renderer ) { String bundleRendererCtxAttributeName = BUNDLE_RENDERER_CONTEXT_ATTR_PREFIX + renderer . getResourceType ( ) ; String jawrErrorDispathAttributeName = JAWR_ERROR_DISPATCH + renderer . getResourceType (... | Returns the bundle renderer context . |
2,632 | protected static void clearRequestWhenDispatch ( HttpServletRequest request , String requestDispatchAttribute , String bundleRendererCtxAttributeName , String jawrDispathAttributeName ) { if ( request . getAttribute ( requestDispatchAttribute ) != null && request . getAttribute ( jawrDispathAttributeName ) == null ) { ... | Clears the request when dispatch |
2,633 | public static void setBundleRendererContext ( ServletRequest request , String resourceType , BundleRendererContext ctx ) { String globalBundleAddedAttributeName = BUNDLE_RENDERER_CONTEXT_ATTR_PREFIX + resourceType ; request . setAttribute ( globalBundleAddedAttributeName , ctx ) ; } | Sets the bundle renderer context . |
2,634 | public static boolean isRequestGzippable ( HttpServletRequest req , JawrConfig jawrConfig ) { boolean rets ; if ( ! jawrConfig . isGzipResourcesModeOn ( ) ) rets = false ; else if ( req . getHeader ( "Accept-Encoding" ) != null && req . getHeader ( "Accept-Encoding" ) . contains ( "gzip" ) ) { if ( ! jawrConfig . isGzi... | Determines whether gzip is suitable for the current request given the current config . |
2,635 | public static boolean isIE ( HttpServletRequest req ) { String agent = req . getHeader ( "User-Agent" ) ; return null != agent && agent . contains ( "MSIE" ) ; } | Checks if the user agent is IE |
2,636 | private static boolean isIEVersionInferiorOrEqualTo ( HttpServletRequest req , int ieVersion ) { boolean result = false ; String agent = req . getHeader ( "User-Agent" ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "User-Agent for this request:" + agent ) ; } if ( agent != null ) { Matcher matcher = IE_USER_... | Checks if the user agent is IE and the version is equal or less than the one passed in parameter |
2,637 | public static void setRequestDebuggable ( HttpServletRequest req , JawrConfig jawrConfig ) { if ( jawrConfig . getDebugOverrideKey ( ) . length ( ) > 0 && null != req . getParameter ( JawrConstant . OVERRIDE_KEY_PARAMETER_NAME ) && jawrConfig . getDebugOverrideKey ( ) . equals ( req . getParameter ( JawrConstant . OVER... | Determines whether to override the debug settings . Sets the debugOverride status on ThreadLocalJawrContext |
2,638 | public static void inheritSessionDebugProperty ( HttpServletRequest request ) { HttpSession session = request . getSession ( false ) ; if ( session != null ) { String sessionId = session . getId ( ) ; JawrApplicationConfigManager appConfigMgr = ( JawrApplicationConfigManager ) session . getServletContext ( ) . getAttri... | Sets a request debuggable if the session is a debuggable session . |
2,639 | public static String getRenderedUrl ( String url , JawrConfig jawrConfig , String contextPath , boolean sslRequest ) { String contextPathOverride = getContextPathOverride ( sslRequest , jawrConfig ) ; String renderedUrl = url ; if ( contextPathOverride != null && ( ( jawrConfig . isDebugModeOn ( ) && jawrConfig . isUse... | Renders the URL taking in account the context path the jawr config |
2,640 | public static boolean refreshConfigIfNeeded ( HttpServletRequest request , JawrConfig jawrConfig ) { boolean refreshed = false ; if ( request . getAttribute ( JawrConstant . JAWR_BUNDLE_REFRESH_CHECK ) == null ) { request . setAttribute ( JawrConstant . JAWR_BUNDLE_REFRESH_CHECK , Boolean . TRUE ) ; if ( jawrConfig . g... | Refresh the Jawr config if a manual reload has been ask using the refresh key parameter from the URL |
2,641 | public Map < String , Map < String , VariantSet > > getSkinMapping ( ResourceBrowser rsBrowser , JawrConfig config ) { Map < String , Map < String , VariantSet > > currentSkinMapping = new HashMap < > ( ) ; PropertiesConfigHelper props = new PropertiesConfigHelper ( config . getConfigProperties ( ) , JawrConstant . CSS... | Returns the skin mapping from the Jawr config |
2,642 | private void updateSkinMappingUsingTypeSkinLocale ( ResourceBrowser rsBrowser , JawrConfig config , Map < String , Map < String , VariantSet > > skinMapping , Set < String > skinRootDirectories ) { String defaultSkinName = null ; String defaultLocaleName = null ; for ( Iterator < String > itRootDir = skinRootDirectorie... | Returns the skin mapping from the Jawr config here the resource mapping type is skin_locale |
2,643 | private void updateSkinMappingUsingTypeLocaleSkin ( ResourceBrowser rsBrowser , JawrConfig config , Map < String , Map < String , VariantSet > > skinMapping , Set < String > skinRootDirectories ) { String defaultSkinName = null ; String defaultLocaleName = null ; for ( Iterator < String > itRootDir = skinRootDirectorie... | Returns the skin mapping from the Jawr config here the resource mapping type is locale_skin |
2,644 | public String getSkinRootDir ( String path , Set < String > skinRootDirs ) { String skinRootDir = null ; for ( String skinDir : skinRootDirs ) { if ( path . startsWith ( skinDir ) ) { skinRootDir = skinDir ; } } return skinRootDir ; } | Returns the skin root dir of the path given in parameter |
2,645 | private Map < String , VariantSet > getVariants ( ResourceBrowser rsBrowser , String rootDir , String defaultSkinName , String defaultLocaleName , boolean mappingSkinLocale ) { Set < String > paths = rsBrowser . getResourceNames ( rootDir ) ; Set < String > skinNames = new HashSet < > ( ) ; Set < String > localeVariant... | Initialize the skinMapping from the parent path |
2,646 | private Map < String , VariantSet > getVariants ( String defaultSkin , Set < String > skinNames , String defaultLocaleName , Set < String > localeVariants ) { Map < String , VariantSet > skinVariants = new HashMap < > ( ) ; if ( ! skinNames . isEmpty ( ) ) { skinVariants . put ( JawrConstant . SKIN_VARIANT_TYPE , new V... | Returns the skin variants |
2,647 | private void updateLocaleVariants ( ResourceBrowser rsBrowser , String path , Set < String > localeVariants ) { Set < String > skinPaths = rsBrowser . getResourceNames ( path ) ; for ( Iterator < String > itSkinPath = skinPaths . iterator ( ) ; itSkinPath . hasNext ( ) ; ) { String skinPath = path + itSkinPath . next (... | Update the locale variants from the directory path given in parameter |
2,648 | private void updateSkinVariants ( ResourceBrowser rsBrowser , String path , Set < String > skinVariants ) { Set < String > skinPaths = rsBrowser . getResourceNames ( path ) ; for ( Iterator < String > itSkinPath = skinPaths . iterator ( ) ; itSkinPath . hasNext ( ) ; ) { String skinPath = path + itSkinPath . next ( ) ;... | Update the skin variants from the directory path given in parameter |
2,649 | private void checkRootDirectoryNotOverlap ( String dir , Set < String > skinRootDirectories ) { String rootDir = removeLocaleSuffixIfExist ( dir ) ; for ( Iterator < String > itSkinDir = skinRootDirectories . iterator ( ) ; itSkinDir . hasNext ( ) ; ) { String skinDir = PathNormalizer . asDirPath ( itSkinDir . next ( )... | Check if there are no directory which is contained in another root directory |
2,650 | private String removeLocaleSuffixIfExist ( String dir ) { String result = dir ; String dirName = PathNormalizer . getPathName ( dir ) ; if ( LocaleUtils . LOCALE_SUFFIXES . contains ( dirName ) ) { result = dir . substring ( 0 , dir . indexOf ( "/" + dirName ) + 1 ) ; } return result ; } | Removes from the directory path the locale suffix if it exists |
2,651 | private VariantResourceReaderStrategy getVariantStrategy ( GeneratorContext context , Map < String , VariantSet > variantSetMap ) { VariantResourceReaderStrategy strategy = null ; try { strategy = ( VariantResourceReaderStrategy ) resourceProviderStrategyClass . newInstance ( ) ; strategy . initVariantProviderStrategy ... | Returns the variant strategy |
2,652 | private Reader getResourceReader ( JoinableResourceBundle bundle , String originalPath , ResourceReaderHandler readerHandler , String skinRootDir , String [ ] paths , Map < String , String > variantMap ) { Reader reader = null ; StringBuilder path = new StringBuilder ( skinRootDir ) ; String skinVariant = ( String ) va... | Returns the reader for the resource path defined in parameter |
2,653 | private void initTempDirectory ( String tempDirRoot , boolean createTempSubDir ) { tempDirPath = tempDirRoot ; if ( tempDirPath . contains ( "%20" ) ) tempDirPath = tempDirPath . replaceAll ( "%20" , " " ) ; this . textDirPath = tempDirPath + File . separator + TEMP_TEXT_SUBDIR ; this . gzipDirPath = tempDirPath + File... | Initialize the temporary directories |
2,654 | public Properties getJawrBundleMapping ( ) { final Properties bundleMapping = new Properties ( ) ; InputStream is = null ; try { is = getBundleMappingStream ( ) ; if ( is != null ) { ( ( Properties ) bundleMapping ) . load ( is ) ; } else { LOGGER . info ( "The jawr bundle mapping '" + mappingFileName + "' is not found... | Returns the bundle mapping |
2,655 | private InputStream getBundleMappingStream ( ) { InputStream is = null ; try { is = getTemporaryResourceAsStream ( PathNormalizer . concatWebPath ( tempDirPath + "/" , mappingFileName ) ) ; } catch ( ResourceNotFoundException e ) { } return is ; } | Returns the bundle mapping file |
2,656 | public ReadableByteChannel getResourceBundleChannel ( String bundleName , boolean gzipBundle ) throws ResourceNotFoundException { String tempFileName = getStoredBundlePath ( bundleName , gzipBundle ) ; InputStream is = getTemporaryResourceAsStream ( tempFileName ) ; return Channels . newChannel ( is ) ; } | Returns the readable byte channel from the bundle name |
2,657 | private String getStoredBundlePath ( String bundleName , boolean asGzippedBundle ) { String tempFileName ; if ( asGzippedBundle ) tempFileName = gzipDirPath ; else tempFileName = textDirPath ; return getStoredBundlePath ( tempFileName , bundleName ) ; } | Resolves the file name with which a bundle is stored . |
2,658 | private String getStoredBundlePath ( String rootDir , String bundleName ) { if ( bundleName . indexOf ( '/' ) != - 1 ) { bundleName = bundleName . replace ( '/' , File . separatorChar ) ; } if ( ! bundleName . startsWith ( File . separator ) ) { rootDir += File . separator ; } return rootDir + PathNormalizer . escapeTo... | Resolves the file path of the bundle from the root directory . |
2,659 | @ SuppressWarnings ( "resource" ) private void storeBundle ( String bundleName , String bundledResources , boolean gzipFile , String rootdir ) { if ( LOGGER . isDebugEnabled ( ) ) { String msg = "Storing a generated " + ( gzipFile ? "and gzipped" : "" ) + " bundle with an id of:" + bundleName ; LOGGER . debug ( msg ) ;... | Stores a resource bundle either in text or binary gzipped format . |
2,660 | private File createDir ( String path ) throws IOException { if ( path . contains ( "%20" ) ) path = path . replaceAll ( "%20" , " " ) ; File dir = new File ( path ) ; if ( ! dir . exists ( ) && ! dir . mkdirs ( ) ) throw new BundlingProcessException ( "Error creating temporary jawr directory with path:" + dir . getPath... | Creates a directory . If dir is not created for some reason a runtime exception is thrown . |
2,661 | private File createNewFile ( String path ) throws IOException { if ( path . contains ( "%20" ) ) path = path . replaceAll ( "%20" , " " ) ; File newFile = new File ( path ) ; if ( ! newFile . exists ( ) && ! newFile . createNewFile ( ) ) { throw new BundlingProcessException ( "Unable to create a temporary file at " + p... | Creates a file . If dir is not created for some reason a runtimeexception is thrown . |
2,662 | public void stopWatching ( ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Stopping resource watching" ) ; } this . stopWatching . set ( true ) ; jawrEvtProcessor . stopProcessing ( ) ; jawrEvtProcessor . interrupt ( ) ; } | Sets the flag indicating if we must stop the resource watching |
2,663 | public synchronized void initPathToResourceBundleMap ( List < JoinableResourceBundle > bundles ) throws IOException { for ( JoinableResourceBundle bundle : bundles ) { removePathMappingFromPathMap ( bundle ) ; List < PathMapping > mappings = bundle . getMappings ( ) ; for ( PathMapping pathMapping : mappings ) { regist... | Initialize the map which links path to asset bundle |
2,664 | private void register ( PathMapping pathMapping ) throws IOException { GeneratorRegistry generatorRegistry = bundlesHandler . getConfig ( ) . getGeneratorRegistry ( ) ; List < PathMapping > mappings = new ArrayList < > ( ) ; if ( generatorRegistry . isPathGenerated ( pathMapping . getPath ( ) ) ) { List < PathMapping >... | Register a path mapping |
2,665 | private void registerPathMapping ( PathMapping pathMapping , String filePath ) throws IOException { if ( filePath != null ) { Path p = Paths . get ( filePath ) ; boolean isDir = Files . isDirectory ( p ) ; if ( ! isDir ) { p = p . getParent ( ) ; } if ( pathMapping . isRecursive ( ) ) { registerAll ( p , Arrays . asLis... | Register the path mapping |
2,666 | private void removePathMappingFromPathMap ( JoinableResourceBundle bundle ) { for ( List < PathMapping > pathMappings : pathToResourceBundle . values ( ) ) { for ( Iterator < PathMapping > iterator = pathMappings . iterator ( ) ; iterator . hasNext ( ) ; ) { PathMapping pathMapping = ( PathMapping ) iterator . next ( )... | Removes the path mapping of the bundle given in parameter from map which links Path to resource bundle |
2,667 | private List < JawrConfigManagerMBean > getInitializedConfigurationManagers ( ) { final List < JawrConfigManagerMBean > mBeans = new ArrayList < > ( ) ; if ( jsMBean != null ) { mBeans . add ( jsMBean ) ; } if ( cssMBean != null ) { mBeans . add ( cssMBean ) ; } if ( binaryMBean != null ) { mBeans . add ( binaryMBean )... | Returns the list of initialized configuration managers . |
2,668 | public JawrConfigManagerMBean getConfigMgr ( String resourceType ) { JawrConfigManagerMBean configMgr = null ; if ( resourceType . equals ( JS_TYPE ) ) { configMgr = jsMBean ; } else if ( resourceType . equals ( CSS_TYPE ) ) { configMgr = cssMBean ; } else if ( resourceType . equals ( BINARY_TYPE ) ) { configMgr = bina... | Returns the config manager MBean from the resource type |
2,669 | public String getStringValue ( String property ) { final List < JawrConfigManagerMBean > mBeans = getInitializedConfigurationManagers ( ) ; try { if ( mBeans . size ( ) == 3 ) { if ( areEquals ( getProperty ( jsMBean , property ) , getProperty ( cssMBean , property ) , getProperty ( binaryMBean , property ) ) ) { retur... | Returns the string value of the configuration managers |
2,670 | public void setStringValue ( String property , String value ) { try { if ( jsMBean != null ) { setProperty ( jsMBean , property , value ) ; } if ( cssMBean != null ) { setProperty ( cssMBean , property , value ) ; } if ( binaryMBean != null ) { setProperty ( binaryMBean , property , value ) ; } } catch ( IllegalAccessE... | Update the property with the string value in each config manager . |
2,671 | public boolean areEquals ( String str1 , String str2 ) { return ( str1 == null && str2 == null || str1 != null && str2 != null && str1 . equals ( str2 ) ) ; } | Returns true if the 2 string are equals . |
2,672 | public boolean areEquals ( String str1 , String str2 , String str3 ) { return ( str1 == null && str2 == null && str3 == null || str1 != null && str2 != null && str3 != null && str1 . equals ( str2 ) && str2 . equals ( str3 ) ) ; } | Returns true if the 3 string are equals . |
2,673 | public static String getLocalizedBundleName ( String bundleName , String localeKey ) { String newName = bundleName ; int idxSeparator = bundleName . lastIndexOf ( '.' ) ; if ( StringUtils . isNotEmpty ( localeKey ) && idxSeparator != - 1 ) { newName = bundleName . substring ( 0 , idxSeparator ) ; newName += '_' + local... | Returns the localized bundle name |
2,674 | private static void addSuffixIfAvailable ( String messageBundlePath , Set < String > availableLocaleSuffixes , Locale locale , String fileSuffix , ServletContext servletContext ) { String localMsgResourcePath = toBundleName ( messageBundlePath , locale ) + fileSuffix ; URL resourceUrl = getResourceBundleURL ( localMsgR... | Adds the locale suffix if the message resource bundle file exists . |
2,675 | public static URL getResourceBundleURL ( String resourcePath , ServletContext servletContext ) { URL resourceUrl = null ; try { resourceUrl = ClassLoaderResourceUtils . getResourceURL ( resourcePath , LocaleUtils . class ) ; } catch ( Exception e ) { } if ( resourceUrl == null && servletContext != null && resourcePath ... | Returns the resource bundle URL |
2,676 | @ SuppressWarnings ( "unchecked" ) private StringBuffer buildEngineScript ( StringBuffer engineScript , ServletContext servletContext ) { List < Container > containers = ContainerUtil . getAllPublishedContainers ( servletContext ) ; String allowGetForSafariButMakeForgeryEasier = "" ; String scriptTagProtection = DwrCon... | Performs replacement on the engine . js script from DWR . Mainly copies what DWR does only at startup . A couple params are actually replaced to references to javascript vars that jawr will create on the page . |
2,677 | private StringBuffer readDWRScript ( String classpath ) { StringBuffer sb = null ; try { InputStream is = ClassLoaderResourceUtils . getResourceAsStream ( classpath , this ) ; ReadableByteChannel chan = Channels . newChannel ( is ) ; Reader r = Channels . newReader ( chan , "utf-8" ) ; StringWriter sw = new StringWrite... | Read a DWR utils script from the classpath . |
2,678 | @ SuppressWarnings ( "unchecked" ) private StringBuffer getInterfaceScript ( String scriptName , ServletContext servletContext ) { StringBuffer sb = new StringBuffer ( ENGINE_INIT ) ; List < Container > containers = ContainerUtil . getAllPublishedContainers ( servletContext ) ; boolean found = false ; for ( Iterator < ... | Returns a script with a specified DWR interface |
2,679 | private String getPathReplacementString ( Container container ) { String path = JS_PATH_REF ; if ( null != container . getBean ( DWR_OVERRIDEPATH_PARAM ) ) { path = ( String ) container . getBean ( DWR_OVERRIDEPATH_PARAM ) ; } else if ( null != container . getBean ( DWR_MAPPING_PARAM ) ) { path = JS_CTX_PATH + containe... | Gets the appropriate path replacement string for a DWR container |
2,680 | @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) private StringBuffer getAllPublishedInterfaces ( ServletContext servletContext ) { StringBuffer sb = new StringBuffer ( ) ; List < Container > containers = ContainerUtil . getAllPublishedContainers ( servletContext ) ; for ( Iterator < Container > it = containers . it... | Returns a script with all the DWR interfaces available in the servletcontext |
2,681 | private String removeEngineInit ( String script ) { int start = script . indexOf ( ENGINE_INIT ) ; int end = start + ENGINE_INIT . length ( ) ; StringBuffer rets = new StringBuffer ( ) ; if ( start > 0 ) { rets . append ( script . substring ( 0 , start ) ) . append ( "\n" ) ; } rets . append ( script . substring ( end ... | Removes the engine init script so that it is not repeated unnecesarily . |
2,682 | public String getVariant ( String variantType ) { String variant = null ; if ( bundleVariants != null ) { variant = ( String ) bundleVariants . get ( variantType ) ; } return variant ; } | Returns the current variant for the variant type specified in parameter |
2,683 | protected String prepareStyles ( ) { StringBuffer styles = new StringBuffer ( ) ; prepareAttribute ( styles , "id" , getAttribute ( "styleId" ) ) ; prepareAttribute ( styles , "style" , getAttribute ( "style" ) ) ; prepareAttribute ( styles , "class" , getAttribute ( "styleClass" ) ) ; prepareAttribute ( styles , "titl... | Prepares the style attributes for inclusion in the component s HTML tag . |
2,684 | protected String prepareEventHandlers ( ) { StringBuffer handlers = new StringBuffer ( ) ; prepareMouseEvents ( handlers ) ; prepareKeyEvents ( handlers ) ; return handlers . toString ( ) ; } | Prepares the event handlers for inclusion in the component s HTML tag . |
2,685 | protected void prepareMouseEvents ( StringBuffer handlers ) { prepareAttribute ( handlers , "onclick" , getAttribute ( "onclick" ) ) ; prepareAttribute ( handlers , "ondblclick" , getAttribute ( "ondblclick" ) ) ; prepareAttribute ( handlers , "onmouseover" , getAttribute ( "onmouseover" ) ) ; prepareAttribute ( handle... | Prepares the mouse event handlers appending them to the the given StringBuffer . |
2,686 | protected void prepareKeyEvents ( StringBuffer handlers ) { prepareAttribute ( handlers , "onkeydown" , getAttribute ( "onkeydown" ) ) ; prepareAttribute ( handlers , "onkeyup" , getAttribute ( "onkeyup" ) ) ; prepareAttribute ( handlers , "onkeypress" , getAttribute ( "onkeypress" ) ) ; } | Prepares the keyboard event handlers appending them to the the given StringBuffer . |
2,687 | protected void prepareImageUrl ( FacesContext context , StringBuffer results ) throws IOException { String src = ( String ) getAttributes ( ) . get ( "src" ) ; boolean base64 = Boolean . parseBoolean ( ( String ) getAttributes ( ) . get ( "base64" ) ) ; prepareAttribute ( results , "src" , getImageUrl ( context , src ,... | Prepare the image URL |
2,688 | public void process ( JawrWatchEvent evt ) { Path resolvedPath = evt . getResolvedPath ( ) ; List < PathMapping > mappings = watcher . getPathToResourceBundle ( ) . get ( evt . getDirPath ( ) ) ; if ( mappings != null ) { boolean isDir = Files . isDirectory ( resolvedPath , NOFOLLOW_LINKS ) ; List < JoinableResourceBun... | Process the event |
2,689 | public boolean hasNoEventToProcess ( ) { long currentTime = Calendar . getInstance ( ) . getTimeInMillis ( ) ; return watchEvents . isEmpty ( ) && ( currentTime - lastProcessTime . get ( ) > bundlesHandler . getConfig ( ) . getSmartBundlingDelayAfterLastEvent ( ) ) ; } | Returns true if there is no more event to process |
2,690 | public CompressionResult compress ( String scriptSource ) { Object result = null ; StopWatch stopWatch = new StopWatch ( ) ; stopWatch . start ( "Compressing using Uglify" ) ; try { result = jsEngine . invokeFunction ( "minify" , scriptSource , options ) ; } catch ( NoSuchMethodException | ScriptException e ) { throw n... | Invoke the uglyfication process on the given script code |
2,691 | protected String getUrlPath ( String match , String originalPath , String newCssPath ) throws IOException { String url = match . substring ( match . indexOf ( '(' ) + 1 , match . lastIndexOf ( ')' ) ) . trim ( ) ; String quoteStr = "" ; if ( url . startsWith ( "'" ) || url . startsWith ( "\"" ) ) { quoteStr = url . cha... | Transform a matched url so it points to the proper relative path with respect to the given path . |
2,692 | protected String getRewrittenImagePath ( String originalCssPath , String newCssPath , String url ) throws IOException { String imgUrl = null ; boolean generatedImg = false ; if ( binaryRsHandler != null ) { GeneratorRegistry imgRsGeneratorRegistry = binaryRsHandler . getConfig ( ) . getGeneratorRegistry ( ) ; generated... | Returns the rewritten image path |
2,693 | private boolean isInstanceOf ( Object rd , List < Class < ? > > interfaces ) { boolean result = false ; for ( Class < ? > class1 : interfaces ) { if ( class1 . isInstance ( rd ) ) { result = true ; break ; } } return result ; } | Checks if an object is an instance of on interface from a list of interface |
2,694 | public Object evaluate ( String scriptName , Reader reader ) { try { scriptEngine . put ( ScriptEngine . FILENAME , scriptName ) ; return scriptEngine . eval ( reader ) ; } catch ( ScriptException e ) { throw new BundlingProcessException ( "Error while evaluating script : " + scriptName , e ) ; } } | Evaluates the script |
2,695 | public Object evaluateString ( String scriptName , String source , Bindings bindings ) { try { scriptEngine . put ( ScriptEngine . FILENAME , scriptName ) ; return scriptEngine . eval ( source , bindings ) ; } catch ( ScriptException e ) { throw new BundlingProcessException ( "Error while evaluating script : " + script... | Evaluates the JS passed in parameter |
2,696 | public Object evaluate ( String scriptName , InputStream stream ) { return evaluate ( scriptName , new InputStreamReader ( stream ) ) ; } | Evaluates a script |
2,697 | public Object parseJSON ( String strJson ) throws ScriptException , NoSuchMethodException { Object json = scriptEngine . eval ( "JSON" ) ; Object data = invokeMethod ( json , "parse" , strJson ) ; return data ; } | Returns the JSON object from a string |
2,698 | public Object execEval ( String arg ) { try { return scriptEngine . eval ( "eval(" + arg + ")" ) ; } catch ( ScriptException e ) { throw new BundlingProcessException ( "Error while evaluating a script" , e ) ; } } | Launch eval function on the argument given in parameter |
2,699 | protected Document getWebXmlDocument ( String baseDir ) throws ParserConfigurationException , FactoryConfigurationError , SAXException , IOException { File webXml = new File ( baseDir , WEB_XML_FILE_PATH ) ; DocumentBuilder docBuilder = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; docBuilder . se... | Returns the XML document of the web . xml file |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.