Package javax.faces.application

Examples of javax.faces.application.ResourceHandler


            setScriptAsRendered(context);
            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


    public static String getImageSource(FacesContext context, UIComponent component, String attrName) {

        String resName = (String) component.getAttributes().get("name");
        if (resName != null) {
            String libName = (String) component.getAttributes().get("library");
            ResourceHandler handler = context.getApplication().getResourceHandler();
            Resource res = handler.createResource(resName, libName);
            if (res == null) {
                if (context.isProjectStage(ProjectStage.Development)) {
                    String msg = "Unable to find resource " + resName;
                    context.addMessage(component.getClientId(context),
                                       new FacesMessage(FacesMessage.SEVERITY_ERROR,
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

    if (!isEmpty(resources)) {
      return;
    }

    FacesContext context = FacesContext.getCurrentInstance();
    ResourceHandler handler = context.getApplication().getResourceHandler();
    resources = new LinkedHashSet<>();
    contentLength = 0;
    lastModified = 0;

    for (ResourceIdentifier resourceIdentifier : resourceIdentifiers) {
      Resource resource = handler.createResource(resourceIdentifier.getName(), resourceIdentifier.getLibrary());

      if (resource == null) {
        logger.log(Level.WARNING, String.format(LOG_RESOURCE_NOT_FOUND, resourceIdentifier, id));
        resources.clear();
        return;
View Full Code Here

      // ".reslib" have special treatment by RichFaces specific resource library renderer. They represent multiple
      // resources which are supposed to be dynamically constructed/added with the purpose to keep resource
      // dependencies in RichFaces components "DRY". So far, it are usually only JS resources.
      else if (Hacks.isRichFacesResourceLibraryRenderer(rendererType)) {
        Set<ResourceIdentifier> resourceIdentifiers = Hacks.getRichFacesResourceLibraryResources(id);
        ResourceHandler handler = context.getApplication().getResourceHandler();

        for (ResourceIdentifier identifier : resourceIdentifiers) {
          rendererType = handler.getRendererTypeForResourceName(identifier.getName());
          add(context, null, rendererType, identifier, target);
        }

        componentResourcesToRemove.add(component);
      }
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

        String resourceName = componentResource.getResourceName();
        if (resourceName.endsWith(".xhtml")) {
            resourceName = resourceName.substring(0,
                    resourceName.length() - 6) + ".groovy";
            ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
            result = resourceHandler.createResource(resourceName,
                    componentResource.getLibraryName());
        }
       
        return result;
    }
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
            {
                // If this returns false, handle as follows:
                // call Lifecycle.execute(javax.faces.context.FacesContext)
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.