Package javax.faces.application

Examples of javax.faces.application.ResourceHandler


    }

    public void testCreateResource() throws Exception {
        setupFacesRequest();

        ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();

        assertNotNull(resourceHandler.createResource("org.richfaces.resource.CacheableResourceImpl"));
        assertNotNull(resourceHandler.createResource("org.richfaces.resource.CacheableResourceImpl", ""));
        assertNotNull(resourceHandler.createResource("org.richfaces.resource.CacheableResourceImpl", null));
        assertNotNull(resourceHandler.createResource("defaultResourceHandlerResource.js"));
        assertNotNull(resourceHandler.createResource("libraryResource.js", "org.richfaces.resource.test"));
    }
View Full Code Here


    }

    public void testLibraryExists() throws Exception {
        setupFacesRequest();

        ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();

        assertTrue(resourceHandler.libraryExists("org.richfaces.resource.test"));
    }
View Full Code Here

                this.resourceKey = ResourceConstants.JSF_UNCOMPRESSED;
            }
        }

        private Resource createResource(FacesContext facesContext, ResourceKey resourceInfo) {
            ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
            return resourceHandler.createResource(resourceInfo.getResourceName(), resourceInfo.getLibraryName());
        }
View Full Code Here

    public String getRendererType() {
        return getRendererType(getFacesContext());
    }

    public String getRendererType(FacesContext context) {
        ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
        return resourceHandler.getRendererTypeForResourceName(getName());
    }
View Full Code Here

    public Object getValue(ELContext context, Object base, Object property) {
        checkBaseAndProperty(base, property);

        if (base instanceof ResourceHandler) {
            ResourceHandler handler = (ResourceHandler) base;
            String prop = (String) property;
            Resource resource;
            if (!prop.contains(":")) {
                resource = handler.createResource(prop);
            } else {
                String[] parts = prop.split(":");
                if (parts.length != 2) {
                    throw new ELException(MessageFormat.format(
                            "Invalid resource format. Property {0} contains more than one colon (:)", prop));
                }
                resource = handler.createResource(parts[1], parts[0]);
            }

            context.setPropertyResolved(true);

            if (resource != null) {
View Full Code Here

public abstract class AbstractMediaOutput extends UIOutput implements AccesskeyProps, CoreProps, FocusProps, I18nProps, LinkProps {
    public static final String COMPONENT_TYPE = "org.richfaces.MediaOutput";
    public static final String COMPONENT_FAMILY = "org.richfaces.MediaOutput";

    public Resource getResource() {
        ResourceHandler resourceHandler = getFacesContext().getApplication().getResourceHandler();
        return resourceHandler.createResource(MediaOutputResource.class.getName());
    }
View Full Code Here

            return NO_SCRIPT;
        }
    }

    private static LibraryFunction getScriptResource(FacesContext facesContext, Class<?> javaClass) {
        ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
        String resourceName = javaClass.getSimpleName() + ".js";
        Resource facesResource = resourceHandler.createResource(resourceName, ORG_RICHFACES_CSV, TEXT_JAVASCRIPT);
        if (null != facesResource) {
            final String functionName = firstToLowerCase(javaClass.getSimpleName());
            return new LibraryFunctionImplementation(functionName, resourceName, ORG_RICHFACES_CSV);
        } else {
            return NO_SCRIPT;
View Full Code Here

        final Map<String, Object> attributes = component.getAttributes();
        final String resourceName = (String) attributes.get(JSFAttr.NAME_ATTR);
        if (resourceName != null && (resourceName.length() > 0))
        {

            final ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
            final Resource resource;
           
            final String libraryName = (String) component.getAttributes().get(JSFAttr.LIBRARY_ATTR);
            if ((libraryName != null) && (libraryName.length() > 0))
            {
                resource = resourceHandler.createResource(resourceName, libraryName);
            }
            else
            {
                resource = resourceHandler.createResource(resourceName);   
            }
           
            if (resource == null)
            {
                // If resourceName/libraryName are set but no resource created -> probably a typo,
View Full Code Here

        final Map<String, Object> attributes = component.getAttributes();
        final String resourceName = (String) attributes.get(JSFAttr.NAME_ATTR);
        if (resourceName != null && (resourceName.length() > 0))
        {

            final ResourceHandler resourceHandler = facesContext
                    .getApplication().getResourceHandler();
            final Resource resource;

            final String libraryName = (String) component.getAttributes().get(
                    JSFAttr.LIBRARY_ATTR);
            if ((libraryName != null) && (libraryName.length() > 0))
            {
                resource = resourceHandler.createResource(resourceName,
                        libraryName);
            }
            else
            {
                resource = resourceHandler.createResource(resourceName);
            }

            if (resource == null)
            {
                // If resourceName/libraryName are set but no resource created -> probably a typo,
View Full Code Here

        {
            boolean result = super.containsTagHandler(ns, localName);
           
            if (!result && _compositeLibraryName != null && containsNamespace(ns))
            {
                ResourceHandler resourceHandler =
                    FacesContext.getCurrentInstance().getApplication().getResourceHandler();

                for (String defaultSuffix : _defaultSuffixesArray)
                {
                    String resourceName = localName + defaultSuffix;
                    if (handles(resourceName))
                    {
                        Resource compositeComponentResource = resourceHandler.createResource(
                                resourceName, _compositeLibraryName);
                       
                        if (compositeComponentResource != null)
                        {
                            URL url = compositeComponentResource.getURL();
View Full Code Here

TOP

Related Classes of javax.faces.application.ResourceHandler

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.