eXo Platform 4.0 Documentation > Reference Guide / GateIn > Portal Development > JavaScript development

2.14.4. Portlet dynamic module

Portlet dependencies can be expressed in the gatein-resources.xml file, it forces to declare the portlet dependencies at packaging time when the corresponding war file is created.

The JSR-286 specification provides a mechanism for modifying portal headers that can be used to load JavaScript files. Although this mechanism is portable, it has several drawbacks:

GateIn allows creating dynamic dependencies of a portlet at runtime, when the render phase of the portlet occurs:

public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException {

  resp.setProperty("org.gatein.javascript.dependency", "base");
  resp.addProperty("org.gatein.javascript.dependency", "common");
}

This code is equivalent to the following declaration:


<portlet>
  <name>MyPortlet</name>
  <module>
    <depends>
      <module>base</module>
    </depends>
    <depends>
      <module>common</module>
    </depends>
  </module>
</portlet>
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus