idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
2,500 | public boolean isHandlingCssImage ( String cssResourcePath ) { boolean isHandlingCssImage = false ; ResourceGenerator generator = resolveResourceGenerator ( cssResourcePath ) ; if ( generator != null && cssImageResourceGeneratorRegistry . contains ( generator ) ) { isHandlingCssImage = true ; } return isHandlingCssImag... | Returns true if the generator associated to the css resource path handle also CSS image . |
2,501 | public boolean isGeneratedBinaryResource ( String resourcePath ) { boolean isGeneratedImage = false ; ResourceGenerator generator = resolveResourceGenerator ( resourcePath ) ; if ( generator != null && binaryResourceGeneratorRegistry . contains ( generator ) ) { isGeneratedImage = true ; } return isGeneratedImage ; } | Returns true if the generator associated to the binary resource path is an Image generator . |
2,502 | public Map < String , String > resolveVariants ( HttpServletRequest request ) { Map < String , String > variants = new TreeMap < > ( ) ; for ( VariantResolver resolver : variantResolvers . values ( ) ) { String value = resolver . resolveVariant ( request ) ; if ( value != null ) { variants . put ( resolver . getVariant... | Resolve the variants for the request passed in parameter |
2,503 | public Map < String , String > getAvailableVariantMap ( Map < String , VariantSet > variants , Map < String , String > curVariants ) { Map < String , String > availableVariantMap = new HashMap < > ( ) ; for ( Entry < String , VariantSet > entry : variants . entrySet ( ) ) { String variantType = entry . getKey ( ) ; Var... | Returns the available variants . |
2,504 | public List < PathMapping > getGeneratedPathMappings ( JoinableResourceBundle bundle , String path , ResourceReaderHandler rsReader ) { List < PathMapping > pathMappings = null ; ResourceGenerator resourceGenerator = getResourceGenerator ( path ) ; if ( resourceGenerator instanceof PathMappingProvider ) { pathMappings ... | Returns the PathMapping for the generated resource |
2,505 | protected void prependBase64EncodedResources ( StringBuffer sb , Map < String , Base64EncodedResource > encodedImages ) { Iterator < Entry < String , Base64EncodedResource > > it = encodedImages . entrySet ( ) . iterator ( ) ; StringBuilder mhtml = new StringBuilder ( ) ; String lineSeparator = StringUtils . STR_LINE_F... | Prepend the base64 encoded resources to the bundle data |
2,506 | private int getPriority ( ResourceReader o1 ) { int priority = 0 ; if ( o1 instanceof ServletContextResourceReader ) { priority = baseDirHighPriority ? 5 : 4 ; } else if ( o1 instanceof FileSystemResourceReader ) { priority = baseDirHighPriority ? 4 : 5 ; } else if ( o1 instanceof CssSmartSpritesResourceReader ) { prio... | Returns the priority of the resource reader |
2,507 | private void initMapping ( BinaryResourcesHandler binaryRsHandler ) { if ( jawrConfig . getUseBundleMapping ( ) && rsBundleHandler . isExistingMappingFile ( ) ) { Iterator < Entry < Object , Object > > mapIterator = bundleMapping . entrySet ( ) . iterator ( ) ; while ( mapIterator . hasNext ( ) ) { Entry < Object , Obj... | Initialize the mapping of the binary web resources handler |
2,508 | private void addBinaryResourcePath ( BinaryResourcesHandler binRsHandler , String resourcePath ) { try { String resultPath = CheckSumUtils . getCacheBustedUrl ( resourcePath , rsReaderHandler , jawrConfig ) ; binRsHandler . addMapping ( resourcePath , resultPath ) ; bundleMapping . put ( resourcePath , resultPath ) ; }... | Add an binary resource path to the binary map |
2,509 | private boolean hasBinaryFileExtension ( String path ) { boolean result = false ; int extFileIdx = path . lastIndexOf ( "." ) ; if ( extFileIdx != - 1 && extFileIdx + 1 < path . length ( ) ) { String extension = path . substring ( extFileIdx + 1 ) ; result = binaryMimeTypeMap . containsKey ( extension ) ; } return resu... | Returns true of the path contains a binary file extension |
2,510 | private void addItemsFromDir ( BinaryResourcesHandler binRsHandler , String dirName , boolean addSubDirs ) { Set < String > resources = rsReaderHandler . getResourceNames ( dirName ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Adding " + resources . size ( ) + " resources from path [" + dirName + "] to bin... | Adds all the resources within a path to the image map . |
2,511 | protected String getContentType ( String filePath , HttpServletRequest request ) { String requestUri = request . getRequestURI ( ) ; String extension = getExtension ( filePath ) ; if ( extension == null ) { LOGGER . info ( "No extension found for the request URI : " + requestUri ) ; return null ; } String binContentTyp... | Returns the content type for the image |
2,512 | private String getRealFilePath ( String fileName , BundleHashcodeType bundleHashcodeType ) { String realFilePath = fileName ; if ( bundleHashcodeType . equals ( BundleHashcodeType . INVALID_HASHCODE ) ) { int idx = realFilePath . indexOf ( JawrConstant . URL_SEPARATOR , 1 ) ; if ( idx != - 1 ) { realFilePath = realFile... | Removes the cache buster |
2,513 | private InputStream getResourceInputStream ( String path ) { InputStream is = config . getContext ( ) . getResourceAsStream ( path ) ; if ( is == null ) { try { is = ClassLoaderResourceUtils . getResourceAsStream ( path , this ) ; } catch ( FileNotFoundException e ) { throw new BundlingProcessException ( e ) ; } } retu... | Returns the resource input stream |
2,514 | public String compile ( String resourcePath , String coffeeScriptSource ) { String result = null ; try { result = ( String ) jsEngine . invokeMethod ( coffeeScript , "compile" , coffeeScriptSource , options ) ; } catch ( NoSuchMethodException | ScriptException e ) { throw new BundlingProcessException ( e ) ; } return r... | Compile the CoffeeScript source to a JS source |
2,515 | public StringBuffer serializeBundles ( ) { StringBuffer sb = new StringBuffer ( "{" ) ; for ( Iterator < String > it = keyMap . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { String currentKey = it . next ( ) ; handleKey ( sb , keyMap , currentKey , currentKey , ! it . hasNext ( ) ) ; } return sb . append ( "}" ) ;... | Creates a javascript object literal representing a set of message resources . |
2,516 | @ SuppressWarnings ( "unchecked" ) private void handleKey ( final StringBuffer sb , Map < String , Object > currentLeaf , String currentKey , String fullKey , boolean isLeafLast ) { Map < String , Object > newLeaf = ( Map < String , Object > ) currentLeaf . get ( currentKey ) ; if ( bundleValues . containsKey ( fullKey... | Processes a leaf from the key map adding its name and values recursively in a javascript object literal structure where values are invocations of a method that returns a function . |
2,517 | private String getJsonKey ( String key ) { String jsonKey = key ; if ( addQuoteToKey ) { jsonKey = JavascriptStringUtil . quote ( key ) ; } return jsonKey ; } | Returns the json key for messages taking in account the addQuoteToKey attribute . |
2,518 | private void addValuedKey ( final StringBuffer sb , String key , String fullKey ) { sb . append ( getJsonKey ( key ) ) . append ( ":" ) . append ( FUNC ) . append ( JavascriptStringUtil . quote ( bundleValues . get ( fullKey ) . toString ( ) ) ) ; } | Add a key and its value to the object literal . |
2,519 | public String generateAntiSpamMailto ( String name , String email ) { StringTokenizer st = new StringTokenizer ( email , "@" ) ; if ( Security . containsXssRiskyCharacters ( email ) || st . countTokens ( ) != 2 ) { throw new IllegalArgumentException ( "Invalid email address: " + email ) ; } String before = st . nextTok... | Generate an anti - spam mailto link from an email address |
2,520 | private static void addSuffixIfAvailable ( String messageBundlePath , List < String > availableLocaleSuffixes , Locale locale , String fileSuffix , GrailsServletContextResourceReader rsReader ) { String localMsgResourcePath = toBundleName ( messageBundlePath , locale ) + fileSuffix ; boolean isFileSystemResourcePath = ... | Add the locale suffix if the message resource bundle file exists . |
2,521 | public static boolean isPluginResoucePath ( String resourcePath ) { Matcher matcher = PLUGIN_RESOURCE_PATTERN . matcher ( resourcePath ) ; return matcher . find ( ) ; } | Returns true is the resource path is a plugin path |
2,522 | public static String getRealResourcePath ( String path , Map < String , String > pluginMsgPathMap ) { String realPath = path ; Matcher matcher = PLUGIN_RESOURCE_PATTERN . matcher ( path ) ; StringBuffer sb = new StringBuffer ( ) ; if ( matcher . find ( ) ) { String pluginName = matcher . group ( 2 ) ; String pluginPath... | Handle the mapping of the resource path to the right one . This can be the case for plugin resources . It will returns the file system path or the real path or the same path if the path has not been remapped |
2,523 | public void handleClientSideHandlerRequest ( HttpServletRequest request , HttpServletResponse response ) { Handler handler ; Map < String , String > variants = config . getGeneratorRegistry ( ) . resolveVariants ( request ) ; String variantKey = VariantUtils . getVariantKey ( variants ) ; if ( handlerCache . containsKe... | Generates a locale dependent script used to include bundles in non dynamic html pages . Uses a cache of said scripts to avoid constant regeneration . It also keeps track of eTags and if - modified - since headers to take advantage of client side caching . |
2,524 | private boolean useNotModifiedHeader ( HttpServletRequest request , String scriptEtag ) { long modifiedHeader = - 1 ; try { modifiedHeader = request . getDateHeader ( HEADER_IF_MODIFIED ) ; if ( modifiedHeader != - 1 ) modifiedHeader -= modifiedHeader % 1000 ; } catch ( RuntimeException ex ) { } String eTag = request .... | Determines whether a response should get a 304 response and empty body according to etags and if - modified - since headers . |
2,525 | private void addFilePathMapping ( BundlePathMapping bundlePathMapping , Set < String > paths ) { for ( String path : paths ) { addFilePathMapping ( bundlePathMapping , path ) ; } } | Adds paths to the file path mapping |
2,526 | private void addFilePathMapping ( BundlePathMapping bundlePathMapping , List < BundlePath > itemPathList ) { for ( BundlePath bundlePath : itemPathList ) { addFilePathMapping ( bundlePathMapping , bundlePath . getPath ( ) ) ; } } | Adds bundle paths to the file path mapping |
2,527 | private static String getFullImagePath ( String imgSrc , BinaryResourcesHandler binaryRsHandler , HttpServletRequest request ) { String contextPath = request . getContextPath ( ) ; if ( ! binaryRsHandler . getConfig ( ) . getGeneratorRegistry ( ) . isGeneratedBinaryResource ( imgSrc ) && ! imgSrc . startsWith ( "/" ) )... | Returns the full image path to handle the relative path |
2,528 | public static String getImageUrl ( String imgSrc , PageContext pageContext ) { BinaryResourcesHandler imgRsHandler = ( BinaryResourcesHandler ) pageContext . getServletContext ( ) . getAttribute ( JawrConstant . BINARY_CONTEXT_ATTRIBUTE ) ; if ( null == imgRsHandler ) throw new JawrLinkRenderingException ( "You are usi... | Sames as its counterpart only meant to be used as a JSP EL function . |
2,529 | public static String getBase64EncodedImage ( String imgSrc , BinaryResourcesHandler binaryRsHandler , HttpServletRequest request ) { String encodedResult = null ; if ( null == binaryRsHandler ) { throw new JawrLinkRenderingException ( "You are using a Jawr image tag while the Jawr Image servlet has not been initialized... | Returns the base64 image of the image path given in parameter |
2,530 | public static void setClosingTag ( String flavor ) { if ( FLAVORS_XHTML_EXTENDED . equalsIgnoreCase ( flavor ) ) { closingFlavor = POST_XHTML_EXT_TAG ; } else if ( FLAVORS_HTML . equalsIgnoreCase ( flavor ) ) closingFlavor = POST_HTML_TAG ; else closingFlavor = POST_TAG ; } | Utility method to get the closing tag value based on a config parameter . |
2,531 | private boolean isForcedToRenderIeCssBundleInDebug ( BundleRendererContext ctx , boolean debugOn ) { return debugOn && getResourceType ( ) . equals ( JawrConstant . CSS_TYPE ) && bundler . getConfig ( ) . isForceCssBundleInDebugForIEOn ( ) && RendererRequestUtils . isIE ( ctx . getRequest ( ) ) ; } | Returns true if the renderer must render a CSS bundle link even in debug mode |
2,532 | private void renderIeCssBundleLink ( BundleRendererContext ctx , Writer out , BundlePath bundlePath ) throws IOException { Random randomSeed = new Random ( ) ; int random = randomSeed . nextInt ( ) ; if ( random < 0 ) random *= - 1 ; String path = GeneratorRegistry . IE_CSS_GENERATOR_PREFIX + GeneratorRegistry . PREFIX... | Renders the CSS link to retrieve the CSS bundle for IE in debug mode . |
2,533 | private String compile ( JoinableResourceBundle bundle , String content , String path , GeneratorContext ctx ) throws ScriptException , IOException { try ( InputStream is = getResourceInputStream ( JAWR_IMPORTER_RB ) ) { String script = IOUtils . toString ( is ) ; rubyEngine . eval ( script ) ; } SimpleBindings binding... | Compile the Sass content |
2,534 | private String buildScript ( String path , String content ) { StringBuilder script = new StringBuilder ( ) ; script . append ( "require 'rubygems'\n" + "require 'sass/plugin'\n" + "require 'sass/engine'\n" ) ; content = SassRubyUtils . normalizeMultiByteString ( content ) ; script . append ( String . format ( "customIm... | Builds the ruby script to execute |
2,535 | public final void setCharsetName ( String charsetName ) { if ( ! Charset . isSupported ( charsetName ) ) throw new IllegalArgumentException ( "The specified charset [" + charsetName + "] is not supported by the jvm." ) ; this . charsetName = charsetName ; } | Set the charsetname to be used to interpret and generate resource . |
2,536 | public void setGeneratorRegistry ( GeneratorRegistry generatorRegistry ) { this . generatorRegistry = generatorRegistry ; this . generatorRegistry . setConfig ( this ) ; localeResolver = null ; if ( configProperties . getProperty ( JAWR_LOCALE_RESOLVER ) == null ) { localeResolver = new DefaultLocaleResolver ( ) ; } el... | Set the generator registry |
2,537 | private VariantResolver registerResolver ( VariantResolver defaultResolver , String configPropertyName ) { VariantResolver resolver = null ; if ( configProperties . getProperty ( configPropertyName ) == null ) { resolver = defaultResolver ; } else { resolver = ( VariantResolver ) ClassLoaderResourceUtils . buildObjectI... | Register a resolver in the generator registry |
2,538 | public final void setCssLinkFlavor ( String cssLinkFlavor ) { if ( CSSHTMLBundleLinkRenderer . FLAVORS_HTML . equalsIgnoreCase ( cssLinkFlavor ) || CSSHTMLBundleLinkRenderer . FLAVORS_XHTML . equalsIgnoreCase ( cssLinkFlavor ) || CSSHTMLBundleLinkRenderer . FLAVORS_XHTML_EXTENDED . equalsIgnoreCase ( cssLinkFlavor ) ) ... | Sets the css link flavor |
2,539 | public boolean getBooleanProperty ( String propertyName , boolean defaultValue ) { return Boolean . valueOf ( getProperty ( propertyName , Boolean . toString ( defaultValue ) ) ) ; } | Returns the boolean property value |
2,540 | public String getProperty ( String key , String defaultValue ) { String property = configProperties . getProperty ( key , defaultValue ) ; if ( property != null ) { property = property . trim ( ) ; } return property ; } | Returns the value of the property associated to the key passed in parameter |
2,541 | public String getJavascriptEngineName ( String defaultJsEnginePropName ) { String jsEngineName = null ; if ( StringUtils . isEmpty ( defaultJsEnginePropName ) ) { jsEngineName = getJavascriptEngineName ( ) ; } else { jsEngineName = getProperty ( defaultJsEnginePropName ) ; if ( StringUtils . isEmpty ( jsEngineName ) ) ... | Returns the name of JS engine to use |
2,542 | public void setControllerMapping ( String controllerMapping ) { if ( controllerMapping . endsWith ( "/" ) ) { this . controllerMapping = controllerMapping . substring ( 0 , controllerMapping . length ( ) - 1 ) ; } else { this . controllerMapping = controllerMapping ; } } | Sets the controller mapping |
2,543 | public void augmentConfiguration ( Properties configToAdd ) { for ( Entry < Object , Object > entry : configToAdd . entrySet ( ) ) { String configKey = ( String ) entry . getKey ( ) ; String configValue = ( String ) entry . getValue ( ) ; if ( null != privateConfigProperties && privateConfigProperties . contains ( conf... | Augments the base configuration with the properties specified as parameter . |
2,544 | public HttpServlet initServlet ( ) throws Exception { servlet = ( HttpServlet ) servletClass . newInstance ( ) ; servlet . init ( servletConfig ) ; return servlet ; } | Create a new instance of the servlet and initialize it . |
2,545 | public static String getChecksum ( String url , ResourceReaderHandler rsReader , JawrConfig jawrConfig ) throws IOException , ResourceNotFoundException { String checksum = null ; InputStream is = null ; boolean generatedBinaryResource = jawrConfig . getGeneratorRegistry ( ) . isGeneratedBinaryResource ( url ) ; try { i... | Return the checksum of the path given in parameter if the resource is not found null will b returned . |
2,546 | public static String getCacheBustedUrl ( String url , ResourceReaderHandler rsReader , JawrConfig jawrConfig ) throws IOException , ResourceNotFoundException { String checksum = getChecksum ( url , rsReader , jawrConfig ) ; String result = JawrConstant . CACHE_BUSTER_PREFIX ; boolean generatedBinaryResource = jawrConfi... | Return the cache busted url associated to the url passed in parameter if the resource is not found null will b returned . |
2,547 | public static String getChecksum ( InputStream is , String algorithm ) throws IOException { if ( algorithm . equals ( JawrConstant . CRC32_ALGORITHM ) ) { return getCRC32Checksum ( is ) ; } else if ( algorithm . equals ( JawrConstant . MD5_ALGORITHM ) ) { return getMD5Checksum ( is ) ; } else { throw new BundlingProces... | Returns the checksum value of the input stream taking in count the algorithm passed in parameter |
2,548 | public static String getCRC32Checksum ( InputStream is ) throws IOException { Checksum checksum = new CRC32 ( ) ; byte [ ] bytes = new byte [ 1024 ] ; int len = 0 ; while ( ( len = is . read ( bytes ) ) >= 0 ) { checksum . update ( bytes , 0 , len ) ; } return Long . toString ( checksum . getValue ( ) ) ; } | Returns the CRC 32 Checksum of the input stream |
2,549 | public static String getMD5Checksum ( InputStream is ) throws IOException { byte [ ] digest = null ; try { MessageDigest md = MessageDigest . getInstance ( JawrConstant . MD5_ALGORITHM ) ; InputStream digestIs = new DigestInputStream ( is , md ) ; while ( digestIs . read ( ) != - 1 ) { } digest = md . digest ( ) ; } ca... | Returns the MD5 Checksum of the input stream |
2,550 | public static String getProperty ( Object bean , String name ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { String value = null ; PropertyDescriptor descriptor = getPropertyDescriptor ( bean , name ) ; if ( descriptor == null ) { throw new NoSuchMethodException ( "Unknown property... | Return the value of the specified simple property of the specified bean with string conversions . |
2,551 | public static void setProperty ( Object bean , String name , Object value ) throws IllegalAccessException , InvocationTargetException , NoSuchMethodException { if ( bean == null ) { throw new IllegalArgumentException ( "No bean specified" ) ; } if ( name == null ) { throw new IllegalArgumentException ( "No name specifi... | Set the value of the specified simple property of the specified bean with no type conversions . |
2,552 | private static Object invokeMethod ( Method method , Object bean , Object [ ] values ) throws IllegalAccessException , InvocationTargetException { try { return method . invoke ( bean , values ) ; } catch ( IllegalArgumentException e ) { LOGGER . error ( "Method invocation failed." , e ) ; throw new IllegalArgumentExcep... | This utility method just catches and wraps IllegalArgumentException . |
2,553 | private boolean isSearchingForVariantInPostProcessNeeded ( ) { boolean needToSearch = false ; ResourceBundlePostProcessor [ ] postprocessors = new ResourceBundlePostProcessor [ ] { postProcessor , unitaryCompositePostProcessor , compositePostProcessor , unitaryCompositePostProcessor } ; for ( ResourceBundlePostProcesso... | Checks if it is needed to search for variant in post process |
2,554 | private void splitBundlesByType ( List < JoinableResourceBundle > bundles ) { List < JoinableResourceBundle > tmpGlobal = new ArrayList < > ( ) ; List < JoinableResourceBundle > tmpContext = new ArrayList < > ( ) ; for ( JoinableResourceBundle bundle : bundles ) { if ( bundle . getInclusionPattern ( ) . isGlobal ( ) ) ... | Splits the bundles in two lists one for global lists and other for the remaining bundles . |
2,555 | protected void initBundlePrefixes ( ) { bundlePrefixes = new CopyOnWriteArrayList < > ( ) ; for ( JoinableResourceBundle bundle : globalBundles ) { if ( StringUtils . isNotEmpty ( bundle . getBundlePrefix ( ) ) ) { bundlePrefixes . add ( bundle . getBundlePrefix ( ) ) ; } } for ( JoinableResourceBundle bundle : context... | Initialize the bundle prefixes |
2,556 | private ResourceBundlePathsIterator getBundleIterator ( DebugMode debugMode , List < JoinableResourceBundle > bundles , ConditionalCommentCallbackHandler commentCallbackHandler , Map < String , String > variants ) { ResourceBundlePathsIterator bundlesIterator ; if ( debugMode . equals ( DebugMode . DEBUG ) ) { bundlesI... | Returns the bundle iterator |
2,557 | private StringReader processInLive ( Reader reader ) throws IOException { String requestURL = ThreadLocalJawrContext . getRequestURL ( ) ; StringWriter swriter = new StringWriter ( ) ; IOUtils . copy ( reader , swriter , true ) ; String updatedContent = swriter . getBuffer ( ) . toString ( ) ; if ( requestURL != null )... | Process the bundle content in live |
2,558 | protected String getJawrConfigHashcode ( ) { try { return CheckSumUtils . getMD5Checksum ( config . getConfigProperties ( ) . toString ( ) ) ; } catch ( IOException e ) { throw new BundlingProcessException ( "Unable to calculate Jawr config checksum" , e ) ; } } | Returns the jawr config hashcode |
2,559 | private void executeGlobalPreprocessing ( List < JoinableResourceBundle > bundlesToBuild , boolean processBundleFlag , StopWatch stopWatch ) { stopProcessIfNeeded ( ) ; if ( resourceTypePreprocessor != null ) { if ( stopWatch != null ) { stopWatch . start ( "Global preprocessing" ) ; } GlobalPreprocessingContext ctx = ... | Executes the global preprocessing |
2,560 | public synchronized void rebuildModifiedBundles ( ) { stopProcessIfNeeded ( ) ; StopWatch stopWatch = ThreadLocalJawrContext . getStopWatch ( ) ; if ( config . getUseSmartBundling ( ) ) { if ( watcher != null ) { while ( ! watcher . hasNoEventToProcess ( ) ) { try { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "... | Rebuilds the bundles given in parameter |
2,561 | public void build ( List < JoinableResourceBundle > bundlesToBuild , boolean forceWriteBundleMapping , StopWatch stopWatch ) { stopProcessIfNeeded ( ) ; if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Starting bundle processing" ) ; } notifyStartBundlingProcess ( ) ; boolean mappingFileExists = resourceBundleHandl... | Builds the bundles given in parameter |
2,562 | private void storeJawrBundleMapping ( boolean mappingFileExists , boolean force ) { if ( config . getUseBundleMapping ( ) && ( ! mappingFileExists || force ) ) { bundleMapping . setProperty ( JawrConstant . JAWR_CONFIG_HASHCODE , getJawrConfigHashcode ( ) ) ; resourceBundleHandler . storeJawrBundleMapping ( bundleMappi... | Stores the Jawr bundle mapping |
2,563 | private void executeGlobalPostProcessing ( boolean processBundleFlag , StopWatch stopWatch ) { if ( resourceTypePostprocessor != null ) { if ( stopWatch != null ) { stopWatch . start ( "Global postprocessing" ) ; } GlobalPostProcessingContext ctx = new GlobalPostProcessingContext ( config , this , resourceHandler , pro... | Execute the global post processing |
2,564 | private void joinAndStoreCompositeResourcebundle ( CompositeResourceBundle composite ) { stopProcessIfNeeded ( ) ; BundleProcessingStatus status = new BundleProcessingStatus ( BundleProcessingStatus . FILE_PROCESSING_TYPE , composite , resourceHandler , config ) ; Map < String , VariantSet > compositeBundleVariants = n... | Joins the members of a composite bundle in all its variants storing in a separate file for each variant . |
2,565 | private boolean hasVariantPostProcessor ( JoinableResourceBundle bundle ) { boolean hasVariantPostProcessor = false ; ResourceBundlePostProcessor bundlePostProcessor = bundle . getBundlePostProcessor ( ) ; if ( bundlePostProcessor != null && ( ( AbstractChainedResourceBundlePostProcessor ) bundlePostProcessor ) . isVar... | Checks if the bundle has variant post processor |
2,566 | private void joinAndPostProcessBundle ( CompositeResourceBundle composite , BundleProcessingStatus status ) { JoinableResourceBundleContent store ; stopProcessIfNeeded ( ) ; List < Map < String , String > > allVariants = VariantUtils . getAllVariants ( composite . getVariants ( ) ) ; allVariants . add ( null ) ; for ( ... | Joins and post process the variant composite bundle |
2,567 | private JoinableResourceBundleContent postProcessJoinedCompositeBundle ( CompositeResourceBundle composite , StringBuffer content , BundleProcessingStatus status ) { JoinableResourceBundleContent store = new JoinableResourceBundleContent ( ) ; StringBuffer processedContent = null ; status . setProcessingType ( BundlePr... | Postprocess the composite bundle only if a composite bundle post processor is defined |
2,568 | private void initBundleDataHashcode ( JoinableResourceBundle bundle , JoinableResourceBundleContent store , String variant ) { String bundleHashcode = bundleHashcodeGenerator . generateHashCode ( config , store . getContent ( ) . toString ( ) ) ; bundle . setBundleDataHashCode ( variant , bundleHashcode ) ; } | Initialize the bundle data hashcode and initialize the bundle mapping if needed |
2,569 | private void joinAndStoreBundle ( JoinableResourceBundle bundle ) { BundleProcessingStatus status = new BundleProcessingStatus ( BundleProcessingStatus . FILE_PROCESSING_TYPE , bundle , resourceHandler , config ) ; JoinableResourceBundleContent store = null ; if ( needToSearchForVariantInPostProcess || hasVariantPostPr... | Joins the members of a bundle and stores it |
2,570 | private void storeBundle ( String bundleId , JoinableResourceBundleContent store ) { stopProcessIfNeeded ( ) ; if ( bundleMustBeProcessedInLive ( store . getContent ( ) . toString ( ) ) ) { liveProcessBundles . add ( bundleId ) ; } resourceBundleHandler . storeBundle ( bundleId , store ) ; } | Store the bundle |
2,571 | private void joinAndPostProcessBundle ( JoinableResourceBundle bundle , BundleProcessingStatus status ) { JoinableResourceBundleContent store ; List < Map < String , String > > allVariants = VariantUtils . getAllVariants ( bundle . getVariants ( ) ) ; allVariants . add ( null ) ; for ( Map < String , String > variantMa... | Join and post process the bundle taking in account all its variants . |
2,572 | private JoinableResourceBundleContent joinAndPostprocessBundle ( JoinableResourceBundle bundle , Map < String , String > variants , BundleProcessingStatus status ) { JoinableResourceBundleContent bundleContent = new JoinableResourceBundleContent ( ) ; StringBuffer bundleData = new StringBuffer ( ) ; StringBuffer store ... | Reads all the members of a bundle and executes all associated postprocessors . |
2,573 | private StringBuffer executeUnitaryPostProcessing ( JoinableResourceBundle bundle , BundleProcessingStatus status , StringBuffer content , ResourceBundlePostProcessor defaultPostProcessor ) { StringBuffer bundleData = new StringBuffer ( ) ; status . setProcessingType ( BundleProcessingStatus . FILE_PROCESSING_TYPE ) ; ... | Executes the unitary resource post processing |
2,574 | private StringBuffer executeBundlePostProcessing ( JoinableResourceBundle bundle , BundleProcessingStatus status , StringBuffer bundleData ) { StringBuffer store ; status . setProcessingType ( BundleProcessingStatus . BUNDLE_PROCESSING_TYPE ) ; status . setLastPathAdded ( bundle . getId ( ) ) ; if ( null != bundle . ge... | Execute the bundle post processing |
2,575 | private Container getContainer ( final GeneratorContext context ) { List < Container > containers = StartupUtil . getAllPublishedContainers ( context . getServletContext ( ) ) ; for ( Container container : containers ) { return container ; } throw new RuntimeException ( "FATAL: unable to find DWR Container!" ) ; } | Get the DWR Container . If multiple DWR containers exist in the ServletContext the first found is returned . |
2,576 | private String getInterfaceScript ( String scriptName , final GeneratorContext context ) throws IOException { Container container = getContainer ( context ) ; CreatorManager ctManager = ( CreatorManager ) container . getBean ( CreatorManager . class . getName ( ) ) ; if ( ctManager . getCreator ( scriptName , false ) !... | Get a specific interface script |
2,577 | private String getAllPublishedInterfaces ( final GeneratorContext context ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; Container container = getContainer ( context ) ; CreatorManager ctManager = ( CreatorManager ) container . getBean ( CreatorManager . class . getName ( ) ) ; if ( null != ctManager... | Get all interfaces in one script |
2,578 | protected String compile ( JoinableResourceBundle bundle , String content , String path , GeneratorContext context ) { try { JawrScssResolver scssResolver = new JawrScssResolver ( bundle , rsHandler ) ; JawrScssStylesheet sheet = new JawrScssStylesheet ( bundle , content , path , scssResolver , context . getCharset ( )... | Compile the SASS source to a CSS source |
2,579 | protected Reader generateResourceForDebug ( Reader rd , GeneratorContext context ) { StringWriter writer = new StringWriter ( ) ; try { IOUtils . copy ( rd , writer ) ; String content = rewriteUrl ( context , writer . toString ( ) ) ; rd = new StringReader ( content ) ; } catch ( IOException e ) { throw new BundlingPro... | Returns the resource in debug mode . Here an extra step is used to rewrite the URL in debug mode |
2,580 | protected String rewriteUrl ( GeneratorContext context , String content ) throws IOException { JawrConfig jawrConfig = context . getConfig ( ) ; CssImageUrlRewriter rewriter = new CssImageUrlRewriter ( jawrConfig ) ; String bundlePath = PathNormalizer . joinPaths ( jawrConfig . getServletMapping ( ) , ResourceGenerator... | Rewrite the URL for debug mode |
2,581 | private String getBinaryServletMapping ( ) { String binaryServletMapping = null ; BinaryResourcesHandler binaryRsHandler = ( BinaryResourcesHandler ) config . getContext ( ) . getAttribute ( JawrConstant . BINARY_CONTEXT_ATTRIBUTE ) ; if ( binaryRsHandler != null ) { binaryServletMapping = binaryRsHandler . getConfig (... | Retrieves the binary servlet mapping |
2,582 | public String [ ] getBaseNames ( boolean warDeployed ) { String [ ] names = configParam . split ( GrailsLocaleUtils . RESOURCE_BUNDLE_SEPARATOR ) ; List < String > baseNames = new ArrayList < String > ( ) ; for ( String baseName : names ) { boolean isPluginResoucePath = GrailsLocaleUtils . isPluginResoucePath ( baseNam... | Returns the basenames |
2,583 | protected AbstractChainedGlobalProcessor < GlobalPostProcessingContext > buildProcessorByKey ( String key ) { AbstractChainedGlobalProcessor < GlobalPostProcessingContext > processor = null ; if ( key . equals ( JawrConstant . GLOBAL_GOOGLE_CLOSURE_POSTPROCESSOR_ID ) ) { processor = new ClosureGlobalPostProcessor ( ) ;... | Build the global preprocessor from the ID given in parameter |
2,584 | private void updateBundlesDirtyState ( List < JoinableResourceBundle > bundles , CssSmartSpritesResourceReader cssSpriteResourceReader ) { for ( JoinableResourceBundle bundle : bundles ) { List < BundlePath > bundlePaths = bundle . getItemPathList ( ) ; for ( BundlePath bundlePath : bundlePaths ) { String path = bundle... | Update the bundles dirty state |
2,585 | private void generateSprites ( ResourceReaderHandler cssRsHandler , BinaryResourcesHandler binaryRsHandler , Set < String > resourcePaths , JawrConfig jawrConfig , Charset charset ) { MessageLevel msgLevel = MessageLevel . valueOf ( ERROR_LEVEL ) ; String sinkLevel = WARN_LEVEL ; if ( LOGGER . isTraceEnabled ( ) || LOG... | Generates the image sprites from the smartsprites annotation in the CSS rewrite the CSS files to references the generated sprites . |
2,586 | private Set < String > getResourcePaths ( List < JoinableResourceBundle > bundles ) { Set < String > resourcePaths = new HashSet < > ( ) ; for ( JoinableResourceBundle bundle : bundles ) { for ( BundlePath bundlePath : bundle . getItemPathList ( ) ) { resourcePaths . add ( bundlePath . getPath ( ) ) ; } } return resour... | Returns the list of all CSS files defined in the bundles . |
2,587 | private static List < Map < String , String > > getVariants ( Map < String , String > curVariant , String variantType , Collection < String > variantList ) { List < Map < String , String > > variants = new ArrayList < > ( ) ; for ( String variant : variantList ) { Map < String , String > map = new HashMap < > ( ) ; if ... | Returns the list of variant maps which are initialized with the current map values and each element of the list contains an element of the variant list with the variant type as key |
2,588 | private static List < String > getVariantKeys ( String variantKeyPrefix , Collection < String > variants ) { List < String > variantKeys = new ArrayList < > ( ) ; for ( String variant : variants ) { if ( variant == null ) { variant = "" ; } if ( variantKeyPrefix == null ) { variantKeys . add ( variant ) ; } else { vari... | Returns the variant keys |
2,589 | public static String getVariantKey ( Map < String , String > variants ) { String variantKey = "" ; if ( variants != null ) { variantKey = getVariantKey ( variants , variants . keySet ( ) ) ; } return variantKey ; } | Returns the variant key from the variants given in parameter |
2,590 | public static String getVariantKey ( Map < String , String > curVariants , Set < String > variantTypes ) { String variantKey = "" ; if ( curVariants != null && variantTypes != null ) { Map < String , String > tempVariants = new TreeMap < > ( curVariants ) ; StringBuilder variantKeyBuf = new StringBuilder ( ) ; for ( En... | Resolves a registered path from a locale key using the same algorithm used to locate ResourceBundles . |
2,591 | public static String getVariantBundleName ( String bundleName , String variantKey , boolean iGeneratedResource ) { String newName = bundleName ; if ( StringUtils . isNotEmpty ( variantKey ) ) { int idxSeparator = bundleName . lastIndexOf ( '.' ) ; if ( ! iGeneratedResource && idxSeparator != - 1 ) { newName = bundleNam... | Get the bundle name taking in account the variant key |
2,592 | public static String getVariantBundleName ( String bundleName , Map < String , String > variants , boolean isGeneratedResource ) { String variantKey = getVariantKey ( variants ) ; return getVariantBundleName ( bundleName , variantKey , isGeneratedResource ) ; } | Returns the bundle name from the variants given in parameter |
2,593 | public static Map < String , VariantSet > concatVariants ( Map < String , VariantSet > variantSet1 , Map < String , VariantSet > variantSet2 ) { Map < String , VariantSet > result = new HashMap < > ( ) ; if ( ! isEmpty ( variantSet1 ) && isEmpty ( variantSet2 ) ) { result . putAll ( variantSet1 ) ; } else if ( isEmpty ... | Concatenates 2 map of variant sets . |
2,594 | public void cleanDirectory ( final File directory ) throws IOException { if ( ! directory . exists ( ) ) { final String message = directory + " does not exist" ; throw new IllegalArgumentException ( message ) ; } if ( ! directory . isDirectory ( ) ) { final String message = directory + " is not a directory" ; throw new... | Clean a directory without deleting it . |
2,595 | private String [ ] getClosureCompilerArgs ( GlobalPostProcessingContext ctx , List < JoinableResourceBundle > tmpBundles , Map < String , String > resultBundlePathMapping ) { List < String > args = new ArrayList < > ( ) ; JawrConfig config = ctx . getJawrConfig ( ) ; List < JoinableResourceBundle > bundles = new ArrayL... | Returns the closure compiler arguments |
2,596 | private List < String > getGlobalBundleDependencies ( GlobalPostProcessingContext ctx , List < String > excludedBundles ) { List < JoinableResourceBundle > globalBundles = getRsBundlesHandler ( ctx ) . getGlobalBundles ( ) ; List < String > globalBundleDependencies = new ArrayList < > ( ) ; for ( JoinableResourceBundle... | Returns the global bundle dependencies |
2,597 | private void initCompilerClosureArgumentsFromConfig ( List < String > args , JawrConfig config ) { Set < Entry < Object , Object > > entrySet = config . getConfigProperties ( ) . entrySet ( ) ; for ( Entry < Object , Object > propEntry : entrySet ) { String key = ( String ) propEntry . getKey ( ) ; if ( key . startsWit... | Initialize the closure argument from the Jawr config |
2,598 | private String getCompilerArgValue ( String compilerArgName , String compilerArgValue ) { if ( compilerArgName . equals ( COMPILATION_LEVEL ) ) { if ( ! ADVANCED_OPTIMIZATIONS_COMPILATION_LEVEL . equalsIgnoreCase ( compilerArgValue ) && ! WHITESPACE_ONLY_COMPILATION_LEVEL . equalsIgnoreCase ( compilerArgValue ) && ! SI... | Returns the compiler argument value |
2,599 | private void generateBundleModuleArgs ( List < String > args , Map < String , JoinableResourceBundle > bundleMap , Map < String , String > resultBundleMapping , JoinableResourceBundle bundle , List < String > dependencies ) { Set < String > bundleDependencies = getClosureModuleDependencies ( bundle , dependencies ) ; M... | Generates the bundle module arguments for the closure compiler |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.