idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
2,400 | public String compile ( JoinableResourceBundle bundle , String content , String path , GeneratorContext context ) { JawrLessSource source = new JawrLessSource ( bundle , content , path , rsHandler ) ; try { CompilationResult result = compiler . compile ( source , lessConfig ) ; addLinkedResources ( path , context , sou... | Compile the LESS source to a CSS source |
2,401 | public Set < String > getResourceNames ( String folder ) { String path = super . getResourcePath ( folder ) ; Set < String > assets = locator . listAssets ( path ) ; Set < String > resourceNames = new HashSet < > ( ) ; for ( String asset : assets ) { int idx = asset . indexOf ( path ) ; if ( idx != - 1 ) { String name ... | List assets within a folder . |
2,402 | protected StringBuffer getHeaderSection ( HttpServletRequest request ) { StringBuffer sb = new StringBuffer ( mainScriptTemplate . toString ( ) ) ; sb . append ( "JAWR.app_context_path='" ) . append ( request . getContextPath ( ) ) . append ( "';\n" ) ; return sb ; } | Returns the header section for the client side handler |
2,403 | private String getPathPrefix ( HttpServletRequest request , JawrConfig config ) { if ( request . isSecure ( ) ) { if ( null != config . getContextPathSslOverride ( ) ) { return config . getContextPathSslOverride ( ) ; } } else { if ( null != config . getContextPathOverride ( ) ) { return config . getContextPathOverride... | Determines which prefix should be used for the links according to the context path override if present or using the context path and possibly the jawr mapping . |
2,404 | private void addAllBundles ( List < JoinableResourceBundle > bundles , Map < String , String > variants , StringBuffer buf , boolean useGzip ) { for ( Iterator < JoinableResourceBundle > it = bundles . iterator ( ) ; it . hasNext ( ) ; ) { JoinableResourceBundle bundle = it . next ( ) ; appendBundle ( bundle , variants... | Adds a javascript Resourcebundle representation for each member of a List containing JoinableResourceBundles |
2,405 | 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 . ... | Creates a javascript object that represents a bundle |
2,406 | public Properties getAllMessages ( Locale locale ) { Properties props = new Properties ( ) ; Properties mergedProps = null ; if ( locale == null ) { locale = Locale . getDefault ( ) ; } mergedProps = getMergedProperties ( locale ) . getProperties ( ) ; Set < Entry < Object , Object > > entries = mergedProps . entrySet ... | Returns all the messages |
2,407 | public BundlePathMapping build ( ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Creating bundle path List for " + this . bundle . getId ( ) ) ; } BundlePathMapping bundlePathMapping = new BundlePathMapping ( this . bundle ) ; bundlePathMapping . setPathMappings ( strPathMappings ) ; List < PathMapping > pat... | Detects all files that belong to the bundle and adds them to the bundle path mapping . |
2,408 | private void addPathMapping ( BundlePathMapping bundlePathMapping , String pathMapping ) { addFilePathMapping ( bundlePathMapping , pathMapping ) ; if ( ! bundle . getInclusionPattern ( ) . isIncludeOnlyOnDebug ( ) ) { bundlePathMapping . getItemPathList ( ) . add ( new BundlePath ( bundle . getBundlePrefix ( ) , pathM... | Adds a path mapping to the bundle |
2,409 | protected void addFilePathMapping ( BundlePathMapping bundlePathMapping , String pathMapping ) { long timestamp = 0 ; String filePath = resourceReaderHandler . getFilePath ( pathMapping ) ; if ( filePath != null ) { timestamp = resourceReaderHandler . getLastModified ( filePath ) ; List < FilePathMapping > filePathMapp... | Adds the path mapping to the file path mapping |
2,410 | private String asPath ( String path , boolean generatedResource ) { String result = path ; if ( ! generatedResource ) { result = PathNormalizer . asPath ( path ) ; } return result ; } | Normalizes a path and adds a separator at its start if it s not a generated resource . |
2,411 | public void createBundles ( ) throws Exception { File tempDir = new File ( tempDirPath ) ; if ( ! tempDir . exists ( ) ) { tempDir . mkdirs ( ) ; } else { FileUtils . cleanDirectory ( tempDir ) ; } File destDir = new File ( destDirPath ) ; if ( ! destDir . exists ( ) ) { destDir . mkdirs ( ) ; } else { FileUtils . clea... | Create the bundles . |
2,412 | public static void main ( String [ ] args ) throws Exception { Server server = new Server ( 8080 ) ; server . setStopAtShutdown ( true ) ; server . setHandler ( new WebAppContext ( "web" , "/dwr" ) ) ; server . start ( ) ; server . join ( ) ; } | Sets up and runs server . |
2,413 | public void initVariantProviderStrategy ( GeneratorContext context , Map < String , VariantSet > variantsSetMap ) { List < Map < String , String > > variantMapStrategies = new ArrayList < > ( ) ; Map < String , String > ctxVariantMap = context . getVariantMap ( ) ; VariantSet skinVariantSet = variantsSetMap . get ( Jaw... | Initialize the variant resource provider strategy |
2,414 | private Map < String , String > getVariantMap ( String skinVariant , String localeVariant ) { Map < String , String > variantMap = new HashMap < > ( ) ; variantMap . put ( JawrConstant . SKIN_VARIANT_TYPE , skinVariant ) ; variantMap . put ( JawrConstant . LOCALE_VARIANT_TYPE , localeVariant ) ; return variantMap ; } | Returns the variant map from the skin and the locale parameters |
2,415 | public void init ( ResourceBundlesHandler bundler , Boolean useRandomParam ) { this . bundler = bundler ; if ( useRandomParam == null ) { this . useRandomParam = bundler . getConfig ( ) . isDebugUseRandomParam ( ) ; } else { this . useRandomParam = useRandomParam ; } } | Initializes the bundle link renderer |
2,416 | private void renderBundleDependenciesLinks ( String requestedPath , BundleRendererContext ctx , Writer out , boolean debugOn , List < JoinableResourceBundle > dependencies ) throws IOException { if ( dependencies != null && ! dependencies . isEmpty ( ) ) { for ( JoinableResourceBundle dependencyBundle : dependencies ) ... | Renders the bundle links for the bundle dependencies |
2,417 | protected void renderBundleLinks ( ResourceBundlePathsIterator it , BundleRendererContext ctx , boolean debugOn , Writer out ) throws IOException { String contextPath = ctx . getContextPath ( ) ; boolean useGzip = ctx . isUseGzip ( ) ; boolean isSslRequest = ctx . isSslRequest ( ) ; Random randomSeed = new Random ( ) ;... | Renders the bundle links for the resource iterator passed in parameter |
2,418 | protected void addComment ( String commentText , Writer out ) throws IOException { StringBuilder sb = new StringBuilder ( "<script type=\"text/javascript\">/* " ) ; sb . append ( commentText ) . append ( " */</script>" ) . append ( "\n" ) ; out . write ( sb . toString ( ) ) ; } | Adds an HTML comment to the output stream . |
2,419 | protected String createGzipBundleLink ( String resourceName , String bundlePrefix , String contextPath , boolean isSslRequest ) { String resource = resourceName . substring ( 1 , resourceName . length ( ) ) ; return createBundleLink ( BundleRenderer . GZIP_PATH_PREFIX + resource , bundlePrefix , null , contextPath , is... | Creates a link to a bundle in the page prepending the gzip prefix to its identifier . |
2,420 | protected boolean getUseRandomParamFlag ( JawrConfig config ) { boolean useRandomParamFlag = config . isDebugUseRandomParam ( ) ; if ( useRandomParam != null ) { useRandomParamFlag = Boolean . parseBoolean ( useRandomParam ) ; } return useRandomParamFlag ; } | Returns the flag for the use of random param in debug mode |
2,421 | protected ResourceBundlesHandler getResourceBundlesHandler ( FacesContext context ) { Object handler = context . getExternalContext ( ) . getApplicationMap ( ) . get ( getResourceBundlesHandlerAttributeName ( ) ) ; if ( null == handler ) throw new IllegalStateException ( "ResourceBundlesHandler not present in servlet c... | Returns the resource handler |
2,422 | public static StringBuffer buildRequestSpecificParams ( String contextPath , String dwrPath ) { StringBuffer sb = new StringBuffer ( "<script type=\"text/javascript\">if(!JAWR){var JAWR = {};};" ) ; sb . append ( buildDWRJSParams ( contextPath , dwrPath ) ) ; sb . append ( "</script>" ) . append ( "\n" ) ; return sb ; ... | Adds a script with DWR needed params including a generated ID that DWR needs . |
2,423 | public List < String > getOrphansList ( ) throws DuplicateBundlePathException { JoinableResourceBundleImpl tempBundle = new JoinableResourceOrphanBundleImpl ( "orphansTemp" , "orphansTemp" , this . resourceExtension , new InclusionPattern ( ) , Collections . singletonList ( this . baseDir ) , rsHandler , generatorRegis... | Scan all dirs starting at baseDir and add each orphan resource to the resources map . |
2,424 | private void addFileIfNotMapped ( String filePath ) throws DuplicateBundlePathException { for ( JoinableResourceBundle bundle : currentBundles ) { List < BundlePath > items = bundle . getItemPathList ( ) ; List < BundlePath > itemsDebug = bundle . getItemDebugPathList ( ) ; Set < String > licenses = bundle . getLicense... | Determine whether a resource is already added to some bundle add it to the list if it is not . |
2,425 | protected void initAdditionalPropertyBaseNames ( ServletContext context ) { String propertyNames = context . getInitParameter ( SERVLET_CONTEXT_ADDITIONAL_CONFIG_PARAM ) ; propertyBaseNames = new ArrayList < > ( ) ; if ( null != propertyNames ) { StringTokenizer tk = new StringTokenizer ( propertyNames , "," ) ; while ... | Initializes the propertyBaseNames list by reading the jawr . config . sources servlet context param . Subclasses may override this method to use a different strategy . |
2,426 | public void renderImage ( String imgSource , Map < String , Object > attributes , final Writer writer ) throws IOException { StringBuilder sb = new StringBuilder ( tagStart ) ; sb . append ( "src=\"" ) . append ( imgSource ) . append ( "\" " ) ; for ( Entry < String , Object > mapEntry : attributes . entrySet ( ) ) { s... | Render the actual tag |
2,427 | public static String [ ] split ( String str , String separator ) { return Pattern . compile ( separator ) . split ( str , - 1 ) ; } | Split the String passed in parameter the trailing empty string are kept . |
2,428 | private static String serializeVariantSets ( Map < String , VariantSet > map ) { StringBuilder result = new StringBuilder ( ) ; for ( Entry < String , VariantSet > entry : map . entrySet ( ) ) { result . append ( entry . getKey ( ) ) . append ( ":" ) ; VariantSet variantSet = ( VariantSet ) entry . getValue ( ) ; resul... | Serialize the variant sets . |
2,429 | private static List < String > getBundleNames ( List < JoinableResourceBundle > bundles ) { List < String > bundleNames = new ArrayList < > ( ) ; for ( Iterator < JoinableResourceBundle > iterator = bundles . iterator ( ) ; iterator . hasNext ( ) ; ) { bundleNames . add ( iterator . next ( ) . getName ( ) ) ; } return ... | Returns the list of bundle names |
2,430 | private static String getBundlePostProcessorsName ( ChainedResourceBundlePostProcessor processor ) { String bundlePostProcessor = "" ; if ( processor != null ) { bundlePostProcessor = processor . getId ( ) ; } return bundlePostProcessor ; } | Returns the bundle post processor name separated by a comma character |
2,431 | public void notifyTyping ( String id , String value ) { Util utilAll = new Util ( getUsersToAffect ( ) ) ; utilAll . setValue ( id , Security . replaceXmlCharacters ( value ) ) ; } | Something has changed |
2,432 | public void notifyFocus ( String id ) { Util utilAll = new Util ( getUsersToAffect ( ) ) ; utilAll . addClassName ( id , "disabled" ) ; String addr = WebContextFactory . get ( ) . getHttpServletRequest ( ) . getRemoteAddr ( ) ; utilAll . setValue ( id + "Tip" , addr ) ; } | The user has tabbed in |
2,433 | public void notifyBlur ( String id ) { Util utilAll = new Util ( getUsersToAffect ( ) ) ; utilAll . removeClassName ( id , "disabled" ) ; utilAll . setValue ( id + "Tip" , "" ) ; } | The user has tabbed out |
2,434 | private void initRequestHandler ( ServletContext context , Properties configProps ) throws ServletException { long initialTime = System . currentTimeMillis ( ) ; if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "Initializing jawr config for request handler named " + getInitParameter ( "handlerName" ) ) ; this . servle... | Initialize the request handler |
2,435 | private JawrApplicationConfigManager initApplicationConfigManager ( ) { JawrApplicationConfigManager appConfigMgr = ( JawrApplicationConfigManager ) servletContext . getAttribute ( JawrConstant . JAWR_APPLICATION_CONFIG_MANAGER ) ; if ( appConfigMgr == null ) { appConfigMgr = new JawrApplicationConfigManager ( ) ; serv... | Initialize the application config manager |
2,436 | private void initConfigPropertyResolver ( ServletContext context ) { String configPropertyResolverClass = getInitParameter ( "configPropertyResolverClass" ) ; configPropResolver = null ; if ( null != configPropertyResolverClass ) { configPropResolver = ( ConfigPropertyResolver ) ClassLoaderResourceUtils . buildObjectIn... | Initialize the config property resolver |
2,437 | private ConfigPropertiesSource initConfigPropertiesSource ( ServletContext context , Properties configProps ) throws ServletException { String configLocation = getInitParameter ( "configLocation" ) ; String configPropsSourceClass = getInitParameter ( "configPropertiesSourceClass" ) ; if ( null == configProps && null ==... | Initialize the config properties source that will provide with all configuration options . |
2,438 | protected void initIllegalBundleRequestHandler ( ) { String illegalBundleRequestandlerClassName = jawrConfig . getProperty ( JawrConstant . ILLEGAL_BUNDLE_REQUEST_HANDLER ) ; if ( illegalBundleRequestandlerClassName != null ) { illegalBundleRequestHandler = ( IllegalBundleRequestHandler ) ClassLoaderResourceUtils . bui... | Initialize the illegal bundle request handler |
2,439 | protected ResourceReaderHandler initResourceReaderHandler ( ) { ResourceReaderHandler rsHandler = null ; if ( servletContext != null ) { try { rsHandler = new ServletContextResourceReaderHandler ( servletContext , jawrConfig , generatorRegistry ) ; } catch ( IOException e ) { throw new BundlingProcessException ( e ) ; ... | Initialize the resource reader handler |
2,440 | protected ResourceBundleHandler initResourceBundleHandler ( ) { ResourceBundleHandler rsHandler = null ; if ( jawrConfig . getUseBundleMapping ( ) && StringUtils . isNotEmpty ( jawrConfig . getJawrWorkingDirectory ( ) ) ) { rsHandler = new ServletContextResourceBundleHandler ( servletContext , jawrConfig . getJawrWorki... | Initialize the resource bundle handler |
2,441 | protected JawrConfig createJawrConfig ( Properties props ) { jawrConfig = new JawrConfig ( resourceType , props , configPropResolver ) ; if ( ThreadLocalJawrContext . isBundleProcessingAtBuildTime ( ) ) { jawrConfig . setUseBundleMapping ( true ) ; jawrConfig . setJawrWorkingDirectory ( null ) ; } return jawrConfig ; } | Create the Jawr config from the properties |
2,442 | public void doGet ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { try { String requestedPath = "" . equals ( jawrConfig . getServletMapping ( ) ) ? request . getServletPath ( ) : request . getPathInfo ( ) ; processRequest ( requestedPath , request , response ) ; } c... | Handles a resource request by getting the requested path from the request object and invoking processRequest . |
2,443 | protected void initThreadLocalJawrContext ( HttpServletRequest request ) { ThreadLocalJawrContext . setJawrConfigMgrObjectName ( JmxUtils . getJawrConfigMBeanObjectName ( request . getContextPath ( ) , resourceType , jawrConfig . getProperty ( JawrConstant . JAWR_JMX_MBEAN_PREFIX ) ) ) ; ThreadLocalJawrContext . setReq... | Initialize the ThreadLocalJawrContext |
2,444 | protected boolean copyRequestedContentToResponse ( String requestedPath , HttpServletResponse response , String contentType ) throws IOException { boolean copyDone = false ; if ( isValidRequestedPath ( requestedPath ) ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Path '" + requestedPath + "' does not belon... | Copy the requested content to the response |
2,445 | protected boolean handleSpecificRequest ( String requestedPath , HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { boolean processed = false ; if ( CLIENTSIDE_HANDLER_REQ_PATH . equals ( requestedPath ) ) { this . clientSideScriptRequestHandler . handleClientSideHandler... | Handle the specific requests |
2,446 | protected BundleHashcodeType isValidBundle ( String requestedPath ) { BundleHashcodeType bundleHashcodeType = BundleHashcodeType . VALID_HASHCODE ; if ( ! jawrConfig . isDebugModeOn ( ) ) { bundleHashcodeType = bundlesHandler . getBundleHashcodeType ( requestedPath ) ; } return bundleHashcodeType ; } | Returns true if the bundle is a valid bundle |
2,447 | protected void writeContent ( String requestedPath , HttpServletRequest request , HttpServletResponse response ) throws IOException , ResourceNotFoundException { int idx = requestedPath . indexOf ( BundleRenderer . GZIP_PATH_PREFIX ) ; if ( idx != - 1 ) { requestedPath = JawrConstant . URL_SEPARATOR + requestedPath . s... | Writes the content to the output stream |
2,448 | private void handleGeneratedCssInDebugMode ( String requestedPath , HttpServletRequest request , HttpServletResponse response , BinaryResourcesHandler binaryRsHandler ) throws ResourceNotFoundException , IOException { Reader rd = rsReaderHandler . getResource ( null , requestedPath ) ; if ( rd == null ) { throw new Res... | Handle the generated CSS content in debug mode . |
2,449 | private String getRequestPath ( HttpServletRequest request ) { String finalUrl = null ; String servletPath = request . getServletPath ( ) ; if ( "" . equals ( jawrConfig . getServletMapping ( ) ) ) { finalUrl = PathNormalizer . asPath ( servletPath ) ; } else { finalUrl = PathNormalizer . asPath ( servletPath + request... | Returns the request path |
2,450 | protected void setResponseHeaders ( HttpServletResponse resp ) { resp . setHeader ( CACHE_CONTROL_HEADER , CACHE_CONTROL_VALUE ) ; resp . setHeader ( LAST_MODIFIED_HEADER , LAST_MODIFIED_VALUE ) ; resp . setHeader ( ETAG_HEADER , ETAG_VALUE ) ; Calendar cal = Calendar . getInstance ( ) ; cal . roll ( Calendar . YEAR , ... | Adds aggressive caching headers to the response in order to prevent browsers requesting the same file twice . |
2,451 | public List < String > getDirtyBundleNames ( ) { List < String > bundleNames = new ArrayList < > ( ) ; if ( bundlesHandler != null ) { bundleNames = bundlesHandler . getDirtyBundleNames ( ) ; } return bundleNames ; } | Returns the names of the dirty bundles |
2,452 | public synchronized void rebuildDirtyBundles ( ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Rebuild dirty bundles" ) ; } StopWatch stopWatch = new StopWatch ( ) ; ThreadLocalJawrContext . setStopWatch ( stopWatch ) ; ThreadLocalJawrContext . setJawrConfigMgrObjectName ( JmxUtils . getMBeanObjectName ( ser... | Refresh the dirty bundles |
2,453 | public void setPerson ( Person person ) { log . debug ( "Adding person: " + person ) ; if ( person . getId ( ) == - 1 ) { person . setId ( getNextId ( ) ) ; } people . remove ( person ) ; people . add ( person ) ; } | Insert a person into the set of people |
2,454 | public void deletePerson ( Person person ) { log . debug ( "Removing person: " + person ) ; people . remove ( person ) ; debug ( ) ; } | Delete a person from the set of people |
2,455 | private Person getRandomPerson ( ) { Person person = new Person ( ) ; person . setId ( getNextId ( ) ) ; String firstname = FIRSTNAMES [ random . nextInt ( FIRSTNAMES . length ) ] ; String surname = SURNAMES [ random . nextInt ( SURNAMES . length ) ] ; person . setName ( firstname + " " + surname ) ; String housenum = ... | Create a random person |
2,456 | public String getPath ( String base , String uri ) throws ResourceNotFoundException , IOException { String fileName = uri ; if ( ! fileName . endsWith ( ".scss" ) ) { fileName += ".scss" ; } String parentPath = base . replace ( '\\' , '/' ) ; fileName = fileName . replace ( '\\' , '/' ) ; return PathNormalizer . concat... | Returns the path of the resource |
2,457 | public String findRelative ( String base , String uri ) throws ResourceNotFoundException , IOException { String path = getPath ( base , uri ) ; String source = resolveAndNormalize ( path ) ; if ( source != null ) { return source ; } path = PathNormalizer . getParentPath ( path ) + "_" + PathNormalizer . getPathName ( p... | Return the content of the resource using the base path and the relative URI |
2,458 | protected String resolveAndNormalize ( String path ) throws ResourceNotFoundException , IOException { List < Class < ? > > excluded = new ArrayList < > ( ) ; excluded . add ( ISassResourceGenerator . class ) ; Reader rd = null ; try { rd = rsHandler . getResource ( bundle , path , false , excluded ) ; addLinkedResource... | Finds and and normalized the content of the resource |
2,459 | protected void addLinkedResource ( String path ) { FilePathMapping linkedResource = getFilePathMapping ( path ) ; if ( linkedResource != null ) { addLinkedResource ( linkedResource ) ; if ( bundle != null ) { bundle . getLinkedFilePathMappings ( ) . add ( new FilePathMapping ( bundle , linkedResource . getPath ( ) , li... | Adds a path to the linked resource |
2,460 | private AbstractChainedResourceBundlePostProcessor addOrCreateChain ( AbstractChainedResourceBundlePostProcessor chain , String key ) { AbstractChainedResourceBundlePostProcessor toAdd ; if ( customPostProcessors . get ( key ) == null ) { toAdd = buildProcessorByKey ( key ) ; if ( toAdd instanceof BundlingProcessLifeCy... | Creates an AbstractChainedResourceBundlePostProcessor . If the supplied chain is null the new chain is returned . Otherwise it is added to the existing chain . |
2,461 | protected ChainedResourceBundlePostProcessor getCustomProcessorWrapper ( ResourceBundlePostProcessor customProcessor , String key , boolean isVariantPostProcessor ) { return new CustomPostProcessorChainWrapper ( key , customProcessor , isVariantPostProcessor ) ; } | Returns the custom processor wrapper |
2,462 | public void setVariants ( Map < String , VariantSet > variantSets ) { if ( variantSets != null ) { this . variants = new TreeMap < > ( variantSets ) ; variantKeys = VariantUtils . getAllVariantKeys ( this . variants ) ; } } | Set the list of variants for variant resources |
2,463 | private List < BundlePath > getItemPathList ( List < BundlePath > itemList , Map < String , String > variants ) { if ( variants == null || variants . isEmpty ( ) ) { return itemList ; } List < BundlePath > rets = new ArrayList < > ( ) ; for ( BundlePath bundlePath : itemList ) { String path = bundlePath . getPath ( ) ;... | Filters the bundlePath list given in parameter using the specified variants |
2,464 | private String getAvailableVariant ( Map < String , String > curVariants ) { String variantKey = null ; if ( variants != null ) { Map < String , String > availableVariants = generatorRegistry . getAvailableVariantMap ( variants , curVariants ) ; variantKey = VariantUtils . getVariantKey ( availableVariants ) ; } return... | Resolves a registered path from a variant key . |
2,465 | private void generateProperties ( JsonNode node , String parentPrefix , Properties props ) { Iterator < Entry < String , JsonNode > > fields = node . fields ( ) ; while ( fields . hasNext ( ) ) { Entry < String , JsonNode > entry = fields . next ( ) ; String fieldName = entry . getKey ( ) ; JsonNode jsonNode = entry . ... | Generates the properties from a JSON node |
2,466 | private String convertToString ( JsonNode jsonArrayNode ) { StringBuilder strBuilder = new StringBuilder ( ) ; Iterator < JsonNode > nodeIterator = jsonArrayNode . iterator ( ) ; while ( nodeIterator . hasNext ( ) ) { JsonNode jsonNode = ( JsonNode ) nodeIterator . next ( ) ; strBuilder . append ( jsonNode . asText ( )... | Converts the json array node to a String |
2,467 | public void setRequestPath ( String mapping , String path ) { this . requestPath = path ; int paramStartIdx = requestPath . indexOf ( "?" ) ; if ( StringUtils . isEmpty ( mapping ) ) { if ( paramStartIdx != - 1 ) { this . servletPath = requestPath . substring ( 0 , paramStartIdx ) ; } else { this . servletPath = reques... | Sets the requested path |
2,468 | private void initParameters ( ) { int idx = requestPath . indexOf ( "?" ) ; if ( idx != - 1 ) { String strParams = null ; try { strParams = URLDecoder . decode ( requestPath . substring ( idx + 1 ) , "UTF-8" ) ; } catch ( UnsupportedEncodingException neverHappens ) { throw new RuntimeException ( "Something went unexpec... | Initialize the parameters from the request path This is a naive implementation which serves only the purpose of bundle generation . It don t even handle multiple parameters value ... |
2,469 | private boolean getBooleanValue ( String strVal , boolean defaultValue ) { boolean result = defaultValue ; if ( strVal != null ) { result = Boolean . parseBoolean ( strVal ) ; } return result ; } | Returns the boolean value of the string passed in parameter or the default value if the string is null |
2,470 | public void setPathMappings ( List < String > pathMappings ) { this . pathMappings . clear ( ) ; if ( pathMappings != null ) { for ( String mapping : pathMappings ) { this . pathMappings . add ( new PathMapping ( bundle , mapping ) ) ; } } } | Sets the path mapping |
2,471 | protected boolean analyzeAutolinkCondition ( final ComponentTag tag ) { if ( tag . getId ( ) == null ) { if ( checkRef ( tag ) ) { return true ; } } return false ; } | Analyze the tag . If return value == true a jawr component will be created . |
2,472 | private final boolean checkRef ( ComponentTag tag ) { boolean ok = false ; if ( ! tag . getName ( ) . equals ( "a" ) ) { IValueMap attributes = tag . getAttributes ( ) ; String ref = attributes . getString ( "href" ) ; if ( ref == null ) { ref = attributes . getString ( "src" ) ; } if ( ( ref != null ) && ( isJawrImage... | Checks if if tag ref is a correct one or not |
2,473 | private boolean isJawrImageTag ( ComponentTag tag ) { String tagName = tag . getName ( ) ; return ( tagName . equalsIgnoreCase ( "img" ) || ( tagName . equalsIgnoreCase ( "input" ) && tag . getAttribute ( "type" ) . equals ( "image" ) ) ) ; } | Checks if it s a Jawr image tag or not |
2,474 | protected void loadConfig ( Properties props , String path , InputStream is ) { try { props . load ( is ) ; } catch ( IOException e ) { throw new BundlingProcessException ( "Unable to load jawr configuration at " + path + "." , e ) ; } } | Loads the configuration from the stream |
2,475 | public BundleHashcodeType getBundleHashcodeType ( String requestedPath ) { if ( binaryResourcePathMap . containsValue ( requestedPath ) ) { return BundleHashcodeType . VALID_HASHCODE ; } BundleHashcodeType bundleHashcodeType = BundleHashcodeType . UNKNOW_BUNDLE ; String [ ] resourceInfo = PathNormalizer . extractBinary... | Checks the bundle hashcode type of the requested binary resource |
2,476 | public static InputStream getResourceAsStream ( String resourcePath , Object source ) throws FileNotFoundException { InputStream is = source . getClass ( ) . getResourceAsStream ( resourcePath ) ; if ( null == is ) { ClassLoader cl = source . getClass ( ) . getClassLoader ( ) ; if ( null != cl ) { is = cl . getResource... | Attempots to load a resource from the classpath either usinf the caller s class loader or the current thread s context classloader . |
2,477 | public static URL getResourceURL ( String resourcePath , Object source ) throws ResourceNotFoundException { URL url = source . getClass ( ) . getResource ( resourcePath ) ; if ( null == url ) { ClassLoader cl = source . getClass ( ) . getClassLoader ( ) ; if ( null != cl ) url = cl . getResource ( resourcePath ) ; } if... | Attempts to find the URL of a resource from the classpath either usinf the caller s class loader or the current thread s context classloader . |
2,478 | public static Enumeration < URL > getResources ( String resourcePath , Object source ) { Enumeration < URL > urls = null ; ClassLoader cl = source . getClass ( ) . getClassLoader ( ) ; try { if ( null != cl ) { urls = cl . getResources ( resourcePath ) ; } if ( null == urls ) { urls = Thread . currentThread ( ) . getCo... | Attempts to find the URLs of a resource from the classpath either using the caller s class loader or the current thread s context classloader . |
2,479 | public static Object buildObjectInstance ( Class < ? > clazz ) { Object rets = null ; try { rets = clazz . newInstance ( ) ; } catch ( Exception e ) { throw new BundlingProcessException ( e . getMessage ( ) + " [The custom class " + clazz . getName ( ) + " could not be instantiated, check whether it is available on the... | Builds a class instance using reflection by using its class . The class must have a zero - arg constructor . |
2,480 | public static boolean isClassPresent ( String classname ) { try { Class . forName ( classname ) ; return true ; } catch ( ClassNotFoundException e ) { } return false ; } | Checks whether the class is present . |
2,481 | public void reset ( ) { this . jawrConfigMgrObjectName = null ; this . debugOverriden = false ; this . bundleProcessingAtBuildTime = false ; this . requestURL = null ; this . stopWatch = null ; this . interruptProcessingBundle . set ( false ) ; } | Reset the context . |
2,482 | private String getCssPathContent ( String cssPathToImport , String media , BundleProcessingStatus status ) throws IOException { String currentCssPath = status . getLastPathAdded ( ) ; String path = cssPathToImport ; JawrConfig jawrConfig = status . getJawrConfig ( ) ; if ( jawrConfig . getGeneratorRegistry ( ) . isPath... | Retrieve the content of the css to import |
2,483 | public Reader createScript ( Charset charset ) { String [ ] names = configParam . split ( "\\|" ) ; Properties props = new Properties ( ) ; Locale currentLocale = getLocaleToApply ( ) ; for ( int x = 0 ; x < names . length ; x ++ ) { ResourceBundle bundle ; try { bundle = ResourceBundle . getBundle ( names [ x ] , curr... | Create the message resource bundles specified and uses a BundleStringJsonifier to generate the properties . |
2,484 | protected Locale getLocaleToApply ( ) { Locale currentLocale = locale ; if ( currentLocale == null ) { currentLocale = control . getFallbackLocale ( ) ; } return currentLocale ; } | Returns the locale to use to retrieve the ResourceBundle |
2,485 | protected Reader doCreateScript ( Properties props ) { BundleStringJsonifier bsj = new BundleStringJsonifier ( props , addQuoteToMessageKey ) ; String script = template . toString ( ) ; String messages = bsj . serializeBundles ( ) . toString ( ) ; script = script . replaceFirst ( "@namespace" , RegexUtil . adaptReplace... | Returns the JS script from the message properties |
2,486 | protected void addLinkedResources ( String path , GeneratorContext context ) { List < Locale > locales = new ArrayList < > ( ) ; Locale currentLocale = context . getLocale ( ) ; if ( currentLocale != null ) { locales . add ( currentLocale ) ; if ( StringUtils . isNotEmpty ( currentLocale . getVariant ( ) ) ) { locales ... | Adds the linked resources |
2,487 | protected List < FilePathMapping > getFileMappings ( String path , GeneratorContext context , List < Locale > locales ) { List < FilePathMapping > fMappings = new ArrayList < > ( ) ; String fileSuffix = PROPERTIES_FILE_SUFFIX ; String [ ] names = path . split ( RESOURCE_BUNDLE_SEPARATOR ) ; for ( String resourcePath : ... | Returns the list of file path mapping associate to the resource bundles locales |
2,488 | protected List < String > findAvailableLocales ( String resource ) { List < String > availableLocales = cachedAvailableLocalePerResource . get ( resource ) ; if ( availableLocales == null ) { availableLocales = LocaleUtils . getAvailableLocaleSuffixesForBundle ( resource ) ; cachedAvailableLocalePerResource . put ( res... | Finds the available locales |
2,489 | protected String getCssPath ( String resourceName ) { String path = resourceName ; if ( jawrConfig . getGeneratorRegistry ( ) . isPathGenerated ( path ) ) { path = path . replace ( ':' , '/' ) ; path = JawrConstant . SPRITE_GENERATED_CSS_DIR + path ; } return path ; } | Returns the Css path from the resource name |
2,490 | private ResourceGenerator loadCommonGenerator ( String resourcePath ) { ResourceGenerator generator = null ; for ( Entry < ResourceGeneratorResolver , Class < ? > > entry : commonGenerators . entrySet ( ) ) { ResourceGeneratorResolver resolver = entry . getKey ( ) ; if ( resolver . matchPath ( resourcePath ) ) { genera... | Lazy loads generators to avoid the need for undesired dependencies . |
2,491 | private void initGenerator ( ResourceGenerator generator ) { initializeGeneratorProperties ( generator ) ; updateRegistries ( generator ) ; ResourceReader proxy = ResourceGeneratorReaderProxyFactory . getResourceReaderProxy ( generator , rsHandler , config ) ; rsHandler . addResourceReader ( proxy ) ; } | Initialize the generator |
2,492 | private void updateRegistries ( ResourceGenerator generator ) { resolverRegistry . add ( new ResourceGeneratorResolverWrapper ( generator , generator . getResolver ( ) ) ) ; GeneratorComparator genComparator = new GeneratorComparator ( ) ; Collections . sort ( resolverRegistry ) ; if ( generator instanceof StreamResour... | Update the registries with the generator given in parameter |
2,493 | public void registerGenerator ( String clazz ) { ResourceGenerator generator = ( ResourceGenerator ) ClassLoaderResourceUtils . buildObjectInstance ( clazz ) ; if ( null == generator . getResolver ( ) ) { throw new IllegalStateException ( "The getResolver() method must return something at " + clazz ) ; } ResourceGenera... | Register a generator mapping it to the specified prefix . |
2,494 | private void initializeGeneratorProperties ( ResourceGenerator generator ) { if ( generator instanceof InitializingResourceGenerator ) { if ( generator instanceof ConfigurationAwareResourceGenerator ) { ( ( ConfigurationAwareResourceGenerator ) generator ) . setConfig ( config ) ; } if ( generator instanceof TypeAwareR... | Initializes the generator properties . |
2,495 | public String getDebugModeGenerationPath ( String path ) { ResourceGenerator resourceGenerator = resolveResourceGenerator ( path ) ; return resourceGenerator . getDebugModeRequestPath ( ) ; } | Returns the path to use in the generation URL for debug mode . |
2,496 | public String getDebugModeBuildTimeGenerationPath ( String path ) { int idx = path . indexOf ( "?" ) ; String debugModeGeneratorPath = path . substring ( 0 , idx ) ; debugModeGeneratorPath = debugModeGeneratorPath . replaceAll ( "\\." , "/" ) ; int jawrGenerationParamIdx = path . indexOf ( JawrRequestHandler . GENERATI... | Returns the path to use in the build time process to generate the resource path for debug mode . |
2,497 | private ResourceGenerator resolveResourceGenerator ( String path ) { ResourceGenerator resourceGenerator = null ; for ( ResourceGeneratorResolverWrapper resolver : resolverRegistry ) { if ( resolver . matchPath ( path ) ) { resourceGenerator = resolver . getResourceGenerator ( ) ; if ( resolver . getType ( ) . equals (... | Finds the resource generator which will handle the resource whose the path is given in parameter |
2,498 | public Map < String , VariantSet > getAvailableVariants ( String path ) { Map < String , VariantSet > availableVariants = new TreeMap < > ( ) ; ResourceGenerator generator = resolveResourceGenerator ( path ) ; if ( generator != null ) { if ( generator instanceof VariantResourceGenerator ) { Map < String , VariantSet > ... | Returns the available variant for a path |
2,499 | public Set < String > getGeneratedResourceVariantTypes ( String path ) { Set < String > variantTypes = new HashSet < > ( ) ; ResourceGenerator generator = resolveResourceGenerator ( path ) ; if ( generator != null ) { if ( generator instanceof VariantResourceGenerator ) { Set < String > tempResult = ( ( VariantResource... | Returns the variant types for a generated resource |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.