Package org.apache.myfaces.shared.resource.ResourceHandlerCache

Examples of org.apache.myfaces.shared.resource.ResourceHandlerCache.ResourceValue


        final String localePrefix = getLocalePrefixForLocateResource();

        // check cache
        if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType, localePrefix))
        {
            ResourceValue resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix);
           
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType);
        }
        else
        {
            for (ResourceLoader loader : getResourceHandlerSupport().getResourceLoaders())
View Full Code Here


        final String localePrefix = getLocalePrefixForLocateResource();

        // check cache
        if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType, localePrefix))
        {
            ResourceValue resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix);
           
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType);
        }
        else
        {
            for (ResourceLoader loader : getResourceHandlerSupport().getResourceLoaders())
View Full Code Here

        final String localePrefix = getLocalePrefixForLocateResource();

        // check cache
        if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType, localePrefix))
        {
            ResourceValue resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix);
           
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType);
        }
        else
        {
            for (ResourceLoader loader : getResourceHandlerSupport().getResourceLoaders())
View Full Code Here

        final String localePrefix = getLocalePrefixForLocateResource();

        // check cache
        if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType, localePrefix))
        {
            ResourceValue resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix);
           
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType);
        }
        else
        {
            for (ResourceLoader loader : getResourceHandlerSupport().getResourceLoaders())
View Full Code Here

        final String localePrefix = getLocalePrefixForLocateResource();

        // check cache
        if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType, localePrefix))
        {
            ResourceValue resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix);
           
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType);
        }
        else
        {
            for (ResourceLoader loader : getResourceHandlerSupport().getResourceLoaders())
View Full Code Here

        final String localePrefix = getLocalePrefixForLocateResource();

        // check cache
        if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType, localePrefix))
        {
            ResourceValue resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix);
           
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType);
        }
        else
        {
            for (ResourceLoader loader : getResourceHandlerSupport().getResourceLoaders())
View Full Code Here

        final String localePrefix = getLocalePrefixForLocateResource();

        // check cache
        if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType, localePrefix))
        {
            ResourceValue resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix);
           
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType);
        }
        else
        {
            for (ResourceLoader loader : getResourceHandlerSupport().getResourceLoaders())
View Full Code Here

        }

        final String localePrefix = getLocalePrefixForLocateResource(facesContext);
        final List<String> contracts = facesContext.getResourceLibraryContracts();
        String contractPreferred = getContractNameForLocateResource(facesContext);
        ResourceValue resourceValue = null;

        // Check cache:
        //
        // Contracts are on top of everything, because it is a concept that defines
        // resources in a application scope concept. It means all resources in
        // /resources or /META-INF/resources can be overriden using a contract. Note
        // it also means resources under /META-INF/flows can also be overriden using
        // a contract.
       
        // Check first the preferred contract if any. If not found, try the remaining
        // contracts and finally if not found try to found a resource without a
        // contract name.
        if (contractPreferred != null)
        {
            resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix, contractPreferred);
        }
        if (resourceValue == null && !contracts.isEmpty())
        {
            // Try to get resource but try with a contract name
            for (String contract : contracts)
            {
                resourceValue = getResourceLoaderCache().getResource(
                    resourceName, libraryName, contentType, localePrefix, contract);
                if (resourceValue != null)
                {
                    break;
                }
            }
        }
        // Only if no contract preferred try without it.
        if (resourceValue == null)
        {
            // Try to get resource without contract name
            resourceValue = getResourceLoaderCache().getResource(resourceName, libraryName, contentType, localePrefix);
        }
       
        if(resourceValue != null)
        {
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType,
                    resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getURL() : null,
                    resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getRequestPath() : null);
        }
        else
        {
            boolean resolved = false;
            // Try preferred contract first
View Full Code Here

        }
       
        FacesContext facesContext = FacesContext.getCurrentInstance();
        final List<String> contracts = facesContext.getResourceLibraryContracts();
        String contractPreferred = getContractNameForLocateResource(facesContext);
        ResourceValue resourceValue = null;
       
        // Check cache:
        //
        // Contracts are on top of everything, because it is a concept that defines
        // resources in a application scope concept. It means all resources in
        // /resources or /META-INF/resources can be overriden using a contract. Note
        // it also means resources under /META-INF/flows can also be overriden using
        // a contract.
        if (contractPreferred != null)
        {
            resourceValue = getResourceLoaderCache().getResource(
                    resourceId, contractPreferred);
        }
        if (resourceValue == null && !contracts.isEmpty())
        {
            // Try to get resource but try with a contract name
            for (String contract : contracts)
            {
                resourceValue = getResourceLoaderCache().getResource(resourceId, contract);
                if (resourceValue != null)
                {
                    break;
                }
            }
        }
        if (resourceValue == null)
        {
            // Try to get resource without contract name
            resourceValue = getResourceLoaderCache().getResource(resourceId);
        }
       
        if(resourceValue != null)
        {       
            //Resolve contentType using ExternalContext.getMimeType
            String contentType = facesContext.getExternalContext().getMimeType(
                resourceValue.getResourceMeta().getResourceName());

            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType,
                    resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getURL() : null,
                    resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getRequestPath() : null);
        }
        else
        {
            boolean resolved = false;
            if (contractPreferred != null)
View Full Code Here

        }
        final String localePrefix = getLocalePrefixForLocateResource(facesContext);
        String contentType = facesContext.getExternalContext().getMimeType(resourceName);
        final List<String> contracts = facesContext.getResourceLibraryContracts();
        String contractPreferred = getContractNameForLocateResource(facesContext);
        ResourceValue resourceValue = null;
       
        // Check cache:
        //
        // Contracts are on top of everything, because it is a concept that defines
        // resources in a application scope concept. It means all resources in
        // /resources or /META-INF/resources can be overriden using a contract. Note
        // it also means resources under /META-INF/flows can also be overriden using
        // a contract.
        if (contractPreferred != null)
        {
            resourceValue = getResourceLoaderCache().getViewResource(
                    resourceName, contentType, localePrefix, contractPreferred);
        }
        if (resourceValue == null && !contracts.isEmpty())
        {
            // Try to get resource but try with a contract name
            for (String contract : contracts)
            {
                resourceValue = getResourceLoaderCache().getViewResource(
                    resourceName, contentType, localePrefix, contract);
                if (resourceValue != null)
                {
                    break;
                }
            }
        }
        if (resourceValue == null)
        {
            // Try to get resource without contract name
            resourceValue = getResourceLoaderCache().getViewResource(
                resourceName, contentType, localePrefix);
        }

        if(resourceValue != null)
        {       
            resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(),
                    getResourceHandlerSupport(), contentType,
                    resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getURL() : null, null);
        }
        else
        {
            boolean resolved = false;
            if (contractPreferred != null)
View Full Code Here

TOP

Related Classes of org.apache.myfaces.shared.resource.ResourceHandlerCache.ResourceValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.