MyFaces Trinidad
  1. MyFaces Trinidad
  2. TRINIDAD-1676

ha: provide facility to support putting uicompoenent references into the session

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.12-core
    • Fix Version/s: 1.2.14-core
    • Component/s: None
    • Labels:
      None

      Description

      We repeatedly see the need from customers to provide support to serialize
      UIComponents in the HTTPSession. However, the problem is that the
      application should not be storing UIComponent instances in the session. For
      an explanation of the issue see:
      http://www.nabble.com/Serializable-UIcomponents-td19471884.html.

      1) A Serialiable UIComponentReference object that can be used to efficiently
      find a component instance using a scoped id. The implementation would store
      both the scoped id and the UIComponent path (say child index/facet name at
      each level, plus names of naming containers traversed) to the component in
      question. If we can find the UIComponent using the path, we return it that
      way, otherwise we use findComponent and then update the path information for
      next time).

      2) A Serialiable UIComponentHolder object that ueses a UIComponentReference
      but also caches a UIComponent during the lifetime of a request a clears it at
      the end of the request or before render response if the viewId changes.

      1. Trinidad-1676.diff
        31 kB
        Matthias Weßendorf

        Activity

        Hide
        Matthias Weßendorf added a comment -

        The idea is to avoid that managed beans (with session scope) have a field
        that is a UIComponent, e.g. RichInputText or UIOutputText.

        The problem with HA is that the UIComponents aren't serialize-able.

        A fix for application developers would be using the "component ID" and the
        findComponent() method to actually query the component, in order to work on
        them.

        Instead the managed bean should use a newly introduced API
        "UIComponentReference". This API should use generics to avoid casting.

        The UIComponentReference creates the scoped ID and remembers the path to the
        actual UIComponent. A getComponent() would return the UIComponent by using
        the remembered path (or via the slower findComponent() if it couldn't find it
        by using the path).

        The class fragment could look like:

        public class UIComponentReference<T extends UIComponent> implements
        Serializable

        { ... public T getComponent(); ... }
        Show
        Matthias Weßendorf added a comment - The idea is to avoid that managed beans (with session scope) have a field that is a UIComponent, e.g. RichInputText or UIOutputText. The problem with HA is that the UIComponents aren't serialize-able. A fix for application developers would be using the "component ID" and the findComponent() method to actually query the component, in order to work on them. Instead the managed bean should use a newly introduced API "UIComponentReference". This API should use generics to avoid casting. The UIComponentReference creates the scoped ID and remembers the path to the actual UIComponent. A getComponent() would return the UIComponent by using the remembered path (or via the slower findComponent() if it couldn't find it by using the path). The class fragment could look like: public class UIComponentReference<T extends UIComponent> implements Serializable { ... public T getComponent(); ... }

          People

          • Assignee:
            Matthias Weßendorf
            Reporter:
            Matthias Weßendorf
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development