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

Enable access to portlet.xml init-params via ExternalContext.getInitParameter(String) and ExternalContext.getInitParameterMap()

    Details

      Description

      Legacy Requirements

      Section 6.1.3.2 of the JSR 329 Specification (titled "Methods that conform with Faces 1.2 Javadoc") describes the following requirements for ExternalContext.getInitParameter(String) and ExternalContext.getInitParameterMap() 

      • getInitParameter()

      Return the value of the specified application initialization parameter (if any). This must be the result of the
      javax.portlet.PortletContext method getInitParameter(name)
      .

      • getInitParameterMap():

      Return an immutable java.util.Map whose keys are the set of application initialization parameter names configured for this application, and whose values are the corresponding parameter values. The returned Map must implement the entire contract for an unmodifiable map as described in the JavaDocs for java.util.Map. This result must be as if it were synthesized by calling the javax.portlet.PortletContext method getInitParameterNames, and putting each configured parameter name/value pair into the result.

      The javax.portlet.PortletContext class essentially decorates javax.servlet.ServletContext. Therefore, a portlet context attribute is a servlet context attribute, and a portlet context "init parameter" is a <context-param> from the WEB-INF/web.xml descriptor.

      Proposal

      This issue serves as a proposal for adding the ability for ExternalContext.getInitParameter(String) and ExternalContext.getInitParameterMap() to first consult WEB-INF/portlet.xml <init-param> via javax.portlet.PortletConfig before consulting javax.portlet.PortletContext. This would allow developers to gain access to portlet.xml <init-param> configurations via the JSF ExternalContext API, as well as provide the ability for a particular portlet to override a more general/global configuration that is specified in the WEB-INF/web.xml descriptor.

      TCK getInitParameterTest (bridge-tck-main-portlet)

      • Verify that each init-param value from portlet.xml is the same as the value from ExternalContext.
      • Verify that each context-param value from web.xml is the same as the value from ExternalContext except for "tckParam2"
        which is expected to be different.
      • Verify that the init parameter value for "tckParam1" from ExternalContext is equal to the context-param value from
        web.xml.
      • Verify that the init parameter value for "tckParam2" from ExternalContext is equal to the init-param value from
        portlet.xml (which verifies that the init-param value from portlet.xml overrides the context-param value from web.xml).

      TCK getInitParameterMapTest (bridge-tck-main-portlet)

      • Verify that the init parameters are the union of init-params from portlet.xml and context-params from web.xml.
      • Verify that the init parameter map is immutable.
      • Verify that the param tckParam1 has the same value found in web.xml.
      • Verify that the param tckParam2 has the same value as the overridden one in portlet.xml. 

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package
                facesbridge-tck-5.0.0
                facesbridge-spec-5.0.0
                bridge-impl-5.0.0