Package javax.faces.application

Examples of javax.faces.application.ResourceHandler.createResource()


                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


    }

    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

            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);
View Full Code Here

                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 ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
        final Resource resource;
       
        if ((libraryName != null) && (libraryName.length() > 0))
        {
            resource = resourceHandler.createResource(resourceName, libraryName);
        }
        else
        {
            resource = resourceHandler.createResource(resourceName);   
        }
View Full Code Here

        {
            resource = resourceHandler.createResource(resourceName, libraryName);
        }
        else
        {
            resource = resourceHandler.createResource(resourceName);   
        }
       
        if (resource == null)
        {
            return "RES_NOT_FOUND";
View Full Code Here

            return;
        }
        // Since we've now determined that it's not in the page, we need to add it.

        ResourceHandler handler = context.getApplication().getResourceHandler();
        Resource resource = handler.createResource(name, library);
        ResponseWriter writer = context.getResponseWriter();
        writer.write('\n');
        writer.startElement("script", null);
        writer.writeAttribute("type", "text/javascript", null);
        writer.writeAttribute("src", ((resource != null) ? resource.getRequestPath() : ""), null);
View Full Code Here

        String resName = (String) component.getAttributes().get("name");
        ResourceHandler handler = context.getApplication().getResourceHandler();
        if (resName != null) {
            String libName = (String) component.getAttributes().get("library");
            Resource res = handler.createResource(resName, libName);
            if (res == null) {
                if (context.isProjectStage(ProjectStage.Development)) {
                    String msg = "Unable to find resource " + (libName == null ? "" : libName + ", ") + resName;
                    context.addMessage(component.getClientId(context),
                                       new FacesMessage(FacesMessage.SEVERITY_ERROR,
View Full Code Here

       
        ViewResource resource1 = resourceHandler.createViewResource(facesContext, "/panel.xhtml");
        Assert.assertNotNull(resource1);
        Assert.assertTrue(resource1.getURL().toString().contains("panel.xhtml"));
       
        Resource resource2 = resourceHandler.createResource("myjs.js", "mylib");
        Assert.assertNotNull(resource2);
       
        tearDownRequest();
    }
View Full Code Here

            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);   
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.