Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-2692

Add RequestAttributeInspector, RequestAttributeInspectorWrapper, and RequestAttributeInspectorFactory to the Bridge API

    Details

      Description

      Similar to FACES-2679 and FACES-2684, over the years we have found it necessary to have an extensions points for supporting different portlet containers. One such extension point is providing the ability for determining attributes that are to be "excluded" from the Bridge Request Scope.

      As described in Section 5.1.2 of the JSR 329 Spec titled "Managing Lifecycle State", the Bridge Request Scope feature solves several problems, such as:
      A. Enables @javax.faces.bean.RequestScoped managed beans and FacesMessages to survive from the ACTION_PHASE of the portlet lifecycle to the RENDER_PHASE.
      B. Supports the "redisplay" use-case (Action->Action Scope)

      • Step 1: Place two non-Ajax JSF portlets on a portal page (A & B)
      • Step 2: Submit a form via portlet A that populates a @RequestScoped managed bean with values from form fields
      • Step 3: Submit a form via portlet B
      • Step 4: Ensure that the values from Step 2 are redisplayed in the form fields

      The JSR 329 Spec describes the Bridge Request Scope as inclusive, meaning that objects living in ExternalContext.getRequestMap() are to be included. However Section 5.1.2.1 titled "Excluding Attributes from the Bridge Request Scope" describes requirements for certain attributes that must be excluded from the Bridge Request Scope.

      This task serves as a proposal for promoting com.liferay.faces.bridge.scope.RequestAttributeInspector, com.liferay.faces.bridge.scope.RequestAttributeInspectorWrapper, and com.liferay.faces.bridge.scope.RequestAttributeInspectorFactory to the javax.portlet.faces package in the Bridge API:

      RequestAttributeInspector.java
      package javax.portlet.faces;
      
      public interface RequestAttributeInspector {
          public boolean containsExcludedNamespace(String name);
          public boolean isExcludedByType(String name, Object value);
          public boolean isExcludedByConfig(String name, Object value);
          public boolean isExcludedByPreExisting(String name, Object value);
          public boolean isExcludedByAnnotation(String name, Object value);
      }
      
      RequestAttributeInspectorFactory.java
      package javax.portlet.faces;
      
      public abstract class RequestAttributeInspectorFactory implements FacesWrapper<RequestAttributeInspectorFactory> {
      
          // Also include corresponding static getRequestAttributeInspector(...) method
          public abstract RequestAttributeInspector getRequestAttributeInspector(PortletRequest portletRequest, PortletConfig portletConfig, BridgeConfig bridgeConfig);
      }
      

      In addition, the Spec will require that the factory delegation chain pattern be supported by bridge implementations. As a matter of convenience to the portlet developer, it is best to use a zero-config mechanism for registering factories, so the bridge implementation must recognize the bridge:request-attribute-inspector-factory element as a child of the factory-extension element of faces-config.xml descriptors.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Packages

                Version Package
                facesbridge-api-5.0.0
                facesbridge-spec-5.0.0