ICEfaces
  1. ICEfaces
  2. ICE-5787

Simplify dispatch infrastructure

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha3
    • Fix Version/s: 2.0-Beta2, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 2.0
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial, Compatibility/Configuration

      Description


      It is likely that the following classes can be simplified considerably in ICEfaces 2.0 since JSF provides dispatching through the resource handler mechanism:

             core/src/main/java/org/icefaces/push/SessionBoundServer.java
             core/src/main/java/org/icefaces/push/DynamicResourceDispatcher.java
             core/src/main/java/org/icefaces/push/servlet/ICEfacesResourceHandler.java
             core/src/main/java/org/icefaces/push/servlet/SessionDispatcher.java
             core/src/main/java/org/icefaces/push/SessionViewManager.java

        Issue Links

          Activity

          Hide
          Mircea Toma added a comment -

          Try to remove ThreadLocal-s and threads.

          Show
          Mircea Toma added a comment - Try to remove ThreadLocal-s and threads.
          Hide
          Ted Goddard added a comment -

          ICEfacesResourceHandler.java appears to contain unused Servlet-specific code.

          Show
          Ted Goddard added a comment - ICEfacesResourceHandler.java appears to contain unused Servlet-specific code.
          Hide
          Ted Goddard added a comment -

          DynamicResourceDispatcher.java depends on ICEfacesResourceHandler.java. It is straightforward to remove some of the thread-blocking related code from ICEfacesResourceHandler, however the resource dispatching infrastructure appears to require more significant changes.

          The current implementation made use of a WeakHashMap to hold weak references to the paths to the resources. Unfortunately, the lifetime of the path String in the heap is not strongly associated with the lifetime of the resource.

          It will be necessary to define a new resource API that allows the developer to indicate the scope of the resource (typically Application or Session) or to store that resource under an EL accessible name in their desired scope.

          public URI addResource(String name, Resource resource) //developer manages the scope
          public URI addApplicationResource(Resource resource)
          public URI addSessionResource(Resource resource)

          The two convenience methods are optional, but if desired, would return a unique, automatically assigned name for resolving the resource.

          Resource resolution would not require any persistent objects other than the resources themselves – the URI is sufficient to resolve the resource when requested.

          Careful attention must be paid to security to ensure that an attacker is not able to request arbitrary session or application objects over the network. It may be sufficient that the resource object must be of a Resource type.

          Show
          Ted Goddard added a comment - DynamicResourceDispatcher.java depends on ICEfacesResourceHandler.java. It is straightforward to remove some of the thread-blocking related code from ICEfacesResourceHandler, however the resource dispatching infrastructure appears to require more significant changes. The current implementation made use of a WeakHashMap to hold weak references to the paths to the resources. Unfortunately, the lifetime of the path String in the heap is not strongly associated with the lifetime of the resource. It will be necessary to define a new resource API that allows the developer to indicate the scope of the resource (typically Application or Session) or to store that resource under an EL accessible name in their desired scope. public URI addResource(String name, Resource resource) //developer manages the scope public URI addApplicationResource(Resource resource) public URI addSessionResource(Resource resource) The two convenience methods are optional, but if desired, would return a unique, automatically assigned name for resolving the resource. Resource resolution would not require any persistent objects other than the resources themselves – the URI is sufficient to resolve the resource when requested. Careful attention must be paid to security to ensure that an attacker is not able to request arbitrary session or application objects over the network. It may be sufficient that the resource object must be of a Resource type.
          Hide
          Ted Goddard added a comment -

          Some of the notable changes:

          • make WindowScope manager both a PhaseListener and a ResourceHandler to give it direct access to dispose-window and the PhaseListener setup operations
          • added compressResources to EnvUtils as a configuration parameter

          Changes verified with auction, compat/component-showcase, and scopes.

          Show
          Ted Goddard added a comment - Some of the notable changes: make WindowScope manager both a PhaseListener and a ResourceHandler to give it direct access to dispose-window and the PhaseListener setup operations added compressResources to EnvUtils as a configuration parameter Changes verified with auction, compat/component-showcase, and scopes.
          Hide
          Ted Goddard added a comment -

          Overall changes complete.

          Show
          Ted Goddard added a comment - Overall changes complete.

            People

            • Assignee:
              Ted Goddard
              Reporter:
              Ted Goddard
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: