org.icefaces.application

## Class ResourceRegistry

- java.lang.Object
- - javax.faces.application.ResourceHandler
  - - javax.faces.application.ResourceHandlerWrapper
    - - org.icefaces.impl.application.SessionAwareResourceHandlerWrapper
      - - org.icefaces.application.ResourceRegistry

- All Implemented Interfaces:
    javax.faces.FacesWrapper<javax.faces.application.ResourceHandler>

      public class ResourceRegistry
      extends org.icefaces.impl.application.SessionAwareResourceHandlerWrapper

  The `ResourceRegistry` allows an application to register javax.faces.application.Resource instances at runtime. Each Resource is registered in a specified scope (Application, Session, View, Flash Window) so that the resource can be garbage collected when the scope expires.

- - ### Field Summary

    - ### Fields inherited from class javax.faces.application.ResourceHandler

      `LOCALE_PREFIX, RESOURCE_EXCLUDES_DEFAULT_VALUE, RESOURCE_EXCLUDES_PARAM_NAME, RESOURCE_IDENTIFIER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResourceRegistry(javax.faces.application.ResourceHandler wrapped)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `addApplicationResource(javax.faces.application.Resource resource)` Add the provided resource in application scope.
    `static java.lang.String` | `addResource(java.util.Map scopeMap, javax.faces.application.Resource resource)` Add the provided resource to the custom scope Map.
    `static java.lang.String` | `addSessionResource(javax.faces.application.Resource resource)` Add the provided resource in session scope.
    `static java.lang.String` | `addViewResource(javax.faces.application.Resource resource)` Add the provided resource in view scope.
    `static java.lang.String` | `addWindowResource(javax.faces.application.Resource resource)` Add the provided resource in window scope.
    `static javax.faces.application.Resource` | `getResourceByName(javax.faces.context.FacesContext facesContext, java.lang.String resName)`
    `javax.faces.application.ResourceHandler` | `getWrapped()`
    `void` | `handleSessionAwareResourceRequest(javax.faces.context.FacesContext facesContext)`
    `boolean` | `isSessionAwareResourceRequest(javax.faces.context.FacesContext context)`

    - ### Methods inherited from class org.icefaces.impl.application.SessionAwareResourceHandlerWrapper

      `handleResourceRequest, isResourceRequest`

    - ### Methods inherited from class javax.faces.application.ResourceHandlerWrapper

      `createResource, createResource, createResource, getRendererTypeForResourceName, libraryExists`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ResourceRegistry

          public ResourceRegistry(javax.faces.application.ResourceHandler wrapped)

  - ### Method Detail

    - #### getWrapped

          public javax.faces.application.ResourceHandler getWrapped()

      Specified by:
        `getWrapped` in interface `javax.faces.FacesWrapper<javax.faces.application.ResourceHandler>`
      Overrides:
        `getWrapped` in class `javax.faces.application.ResourceHandlerWrapper`

    - #### isSessionAwareResourceRequest

          public boolean isSessionAwareResourceRequest(javax.faces.context.FacesContext context)

      Specified by:
        `isSessionAwareResourceRequest` in class `org.icefaces.impl.application.SessionAwareResourceHandlerWrapper`

    - #### handleSessionAwareResourceRequest

          public void handleSessionAwareResourceRequest(javax.faces.context.FacesContext facesContext)
                                                 throws java.io.IOException

      Specified by:
        `handleSessionAwareResourceRequest` in class `org.icefaces.impl.application.SessionAwareResourceHandlerWrapper`
      Throws:
        `java.io.IOException`

    - #### addResource

          public static java.lang.String addResource(java.util.Map scopeMap,
                                                     javax.faces.application.Resource resource)

      Add the provided resource to the custom scope Map. This is intended to be used only in cases not covered by the other scope-specific methods.
      Parameters:
        `scopeMap` - the resource
        `scopeMap` - the resource
      Returns:
        the requestPath of the resource

    - #### getResourceByName

          public static javax.faces.application.Resource getResourceByName(javax.faces.context.FacesContext facesContext,
                                                                           java.lang.String resName)

    - #### addApplicationResource

          public static java.lang.String addApplicationResource(javax.faces.application.Resource resource)

      Add the provided resource in application scope.
      Parameters:
        `resource` - the resource
      Returns:
        the requestPath of the resource

    - #### addSessionResource

          public static java.lang.String addSessionResource(javax.faces.application.Resource resource)

      Add the provided resource in session scope. Note that session scope resources should be Serializable to support cluster replication and session passivation.
      Parameters:
        `resource` - the resource
      Returns:
        the requestPath of the resource

    - #### addViewResource

          public static java.lang.String addViewResource(javax.faces.application.Resource resource)

      Add the provided resource in view scope.
      Parameters:
        `resource` - the resource
      Returns:
        the requestPath of the resource

    - #### addWindowResource

          public static java.lang.String addWindowResource(javax.faces.application.Resource resource)

      Add the provided resource in window scope.
      Parameters:
        `resource` - the resource
      Returns:
        the requestPath of the resource

Copyright 2025 ICEsoft Technologies Canada, Corp. All Rights Reserved.