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

Apply CDN configuration on static resources of a custom portlet

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: portal-2.0.0, portal-3.0.0
    • Fix Version/s: bridge-ext-5.1.0
    • Labels:
    • Environment:

      Description

      1) Set the following in portal-ext.properties
      cdn.host.http=http://localhost
      cdn.host.https=
      2) Install an Apache server on localhost
      3) Copy the whole html folder of the portal into htdocs folder of Apache
      4) Create a custom portlet that loads some css/javascript
      5) Start the portal

      Issue: The static resources of the portlet are being loaded from the original server instead of the CDN node.

      In order to support this feature, the developer could specify a comma-delimited list of JSF2 resource library names in the WEB-INF/web.xml or WEB-INF/portlet.xml descriptor:

      <context-param>
      <param-name>com.liferay.faces.bridge.cdnResourceLibraries</param-name>
      <param-value>primefaces,icefaces,richfaces</param-value>
      </context-param>
      

      Such a configuration would cause ResourceURLs like the following:

      http://www.liferay.com?p_p_id=_1_WAR_jsfportlet_ABCD&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_cacheability=cacheLevelPage&p_p_col_id=column-2&p_p_col_count=7&p_p_col_pos=6&_1_WAR_jsfportlet_ABCD_javax.faces.resource=primefaces.js&_1_WAR_jsfportlet_ABCD_ln=primefaces
      http://www.liferay.com?p_p_id=_1_WAR_jsfportlet_ABCD&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_cacheability=cacheLevelPage&p_p_col_id=column-2&p_p_col_count=7&p_p_col_pos=6&_1_WAR_jsfportlet_ABCD_javax.faces.resource=primefaces.css&_1_WAR_jsfportlet_ABCD_ln=primefaces
      

      ... to be transformed into URLs that would request JSF resources from the CDN-hosted Liferay theme:

      https://cdn.lfrs.sl/www.liferay.com/foo-theme/js/primefaces/primefaces.js
      https://cdn.lfrs.sl/www.liferay.com/foo-theme/css/primefaces/aristo/primefaces.css
      

      ... and subsequent images from the theme would come from:

      https://cdn.lfrs.sl/www.liferay.com/foo-theme/images/primefaces/aristo/primefaces.png
      

        Attachments

          Activity

            People

            Assignee:
            ui_faces UI Faces
            Reporter:
            zalan.szakolci Zalán Szakolci
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Packages

                Version Package
                bridge-ext-5.1.0