Package javax.faces.application

Examples of javax.faces.application.ResourceHandler


        }

        public TagHandler createHandler(TagConfig cfg) throws FacesException, ELException
        {
            FacesContext facesContext = FacesContext.getCurrentInstance();
            ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
            Resource compositeComponentResourceWrapped = resourceHandler.createResourceFromId(resourceId);
            if (compositeComponentResourceWrapped != null)
            {
                Resource compositeComponentResource
                        = new CompositeResouceWrapper(compositeComponentResourceWrapped);
                ComponentConfig componentConfig = new ComponentConfigWrapper(cfg,
View Full Code Here


        FacesContext context = facesContextFactory.getFacesContext
              (servletConfig.getServletContext(), request, response, lifecycle);

        // Execute the request processing lifecycle for this request
        try {
            ResourceHandler handler =
                  context.getApplication().getResourceHandler();
            if (handler.isResourceRequest(context)) {
                handler.handleResourceRequest(context);
            } else {
                lifecycle.execute(context);
                lifecycle.render(context);
            }
        } catch (FacesException e) {
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

            // jsf 2.0 : get the current ResourceHandler and
            // check if it is a resource request, if true
            // delegate to ResourceHandler, else continue with
            // the lifecycle.
            // Acquire the ResourceHandler for this request by calling Application.getResourceHandler().
            ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();

            // Call ResourceHandler.isResourceRequest(javax.faces.context.FacesContext).
            if (resourceHandler.isResourceRequest(facesContext))
            {
                // If this returns true call ResourceHandler.handleResourceRequest(javax.faces.context.FacesContext).
                resourceHandler.handleResourceRequest(facesContext);
            }
            else
            {
                //JSF 2.2: attach window
                _lifecycle.attachWindow(facesContext);
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

        assertTrue(stream.read() != -1);
    }

    public void testCreateResource() throws Exception
    {
        ResourceHandler handler = new MockSimpleResourceHandler(_documentRoot);
        Resource resource = handler.createResource("testfile.js", "testlib");
        assertNotNull("resource could not be created", resource);
        assertTrue(resource.getURL().toString().endsWith(
                "org/apache/myfaces/test/mock/resources/testlib/testfile.js"));
    }
View Full Code Here

                "org/apache/myfaces/test/mock/resources/testlib/testfile.js"));
    }

    public void testResourceHandler() throws Exception
    {
        ResourceHandler handler = new MockSimpleResourceHandler(_documentRoot);

        assertTrue(handler.libraryExists("testlib"));
        assertFalse(handler.libraryExists("notexistinglib"));

        assertEquals("javax.faces.resource.Script", handler
                .getRendererTypeForResourceName("testfile.js"));
    }
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

        facesContext.getViewRoot().addComponentResource(facesContext, outputScript);
    }
   
    public static String getIconSrc(final FacesContext facesContext, final String libraryName, final String resourceName)
    {
        final ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
        final Resource resource;
       
        if ((libraryName != null) && (libraryName.length() > 0))
        {
            resource = resourceHandler.createResource(resourceName, libraryName);
        }
        else
        {
            resource = resourceHandler.createResource(resourceName);   
        }
       
        if (resource == null)
        {
            return "RES_NOT_FOUND";
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.