Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-73282 Implement Portlet 3.0
  3. LPS-80310

Portlet 3.0: Implement HeaderResponse.addDependency() methods

    Details

      Description

      Portlet 3.0 comes with the ability to add client-side JS/CSS resource dependencies in one of three ways:
      1. Dynamically by calling - HeaderResponse.addDependency(String name, String scope, String version) or HeaderResponse.addDependency(String name, String scope, String version, String markup) during the HEADER_PHASE.
      2. Statically by using the @Dependency annotation. For example:

      MyPortlet.java
      @PortletConfiguration(
          dependencies = @Dependency(name="jquery.js", scope="com.jquery", version="2.1.1"))
      public class MyPortlet {
           ...
      }
      

      3. Statically by specifying dependencies in the WEB-INF/portlet.xml descriptor:

      portlet.xml
      <portlet>
          ...
          <dependency>
              <name>jquery</name>
              <scope>com.jquery</scope>
              <version>2.1.1</version>
          </dependency>
          ...
      </portlet>
      

      This issue serves as a task for implementing these features. In all three categories listed above, the dependencies will be added to the <head>...</head> section of a portal page using the WebKeys.PAGE_TOP mechanism. In addition, the URLs generated for accessing these resources will integrate with portal.properties portlet.dependency.css.urn and portlet.dependency.javascript.urn.

      In order to support the liferay-npm-bundler tool at build-time, developers will be able to prevent JS dependencies in category#3 from being added to the <head>...</head> section by specifying the following in WEB-INF/liferay-portlet.xml:

      liferay-portlet.xml
      <liferay-portlet>
          ...
          <portlet-dependency-css-enabled>false</portlet-dependency-css-enabled>
          <portlet-dependency-javascript-enabled>false</portlet-dependency-javascript-enabled>
          ...
      </liferay-portlet>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                brian.chan Brian Chan
                Reporter:
                neil.griffin Neil Griffin
                Recent user:
                Csaba Turcsan
                Participants of an Issue:
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 20 weeks, 5 days ago

                  Packages

                  Version Package
                  7.1.10 DXP FP1
                  7.1.1 CE GA2
                  7.1.10.1 SP1
                  7.1.X
                  Master