Shindig
  1. Shindig
  2. SHINDIG-1227

Allow JavaScript features required by a gadget to be externalized on demand

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-RC2
    • Component/s: Java
    • Labels:
      None

      Description

      This patch introduces a configuration parameter in the properties file "shindig.gadget-rewrite.externalize-feature-libs"

      When this parameter is set to true, RenderingGadgetRewriter will gather all features requested by the gadget and simply add them to the set of extern libraries. As a result, the browser will see <script src='http://shindig-host/gadgets/js/feature1:feature:2:feature3'><script> and get the features specified in the path.

      When this parameter is set to false (the default), RenderingGadgetRewriter will do what it normally does. Inline features requested by the gadget.

      The benefit of setting externalize-feature-libs to true is that browsers can cache features requested by the gadget.

      1. SHINDIG-1227-updated-patch.diff
        7 kB
        Chirag Shah
      2. SHINDIG-1227.patch.diff
        4 kB
        Chirag Shah

        Activity

        Hide
        Paul Lindner added a comment -

        Applied this, it's very valuable.

        Could you also cook up a test for /RenderingGadgetRewriterTest.java?

        Show
        Paul Lindner added a comment - Applied this, it's very valuable. Could you also cook up a test for /RenderingGadgetRewriterTest.java?
        Hide
        Chirag Shah added a comment -

        Updated the patch with the following changes:

        1) Create a single script tag for all features requested by the container. These are either iterated in shindig.properties or the libs query parameter.

        2) Iff shindig.gadget-rewrite.externalize-feature-libs is enabled in shindig.properties, all remaining features requested by the gadget are listed in another script tag.

        3) Clean up some code in RenderingGadgetRewriter while I was in there.

        Show
        Chirag Shah added a comment - Updated the patch with the following changes: 1) Create a single script tag for all features requested by the container. These are either iterated in shindig.properties or the libs query parameter. 2) Iff shindig.gadget-rewrite.externalize-feature-libs is enabled in shindig.properties, all remaining features requested by the gadget are listed in another script tag. 3) Clean up some code in RenderingGadgetRewriter while I was in there.
        Hide
        Paul Lindner added a comment -

        I wonder if it would be useful to generate two script tags?

        One for the externed libs from the libs= param and one for the remainder.

        forced libs would then be a common set of libraries that all apps share and the rest would be cached per app.

        Show
        Paul Lindner added a comment - I wonder if it would be useful to generate two script tags? One for the externed libs from the libs= param and one for the remainder. forced libs would then be a common set of libraries that all apps share and the rest would be cached per app.
        Hide
        Chirag Shah added a comment -

        Patch for SHINDIG-1227

        Show
        Chirag Shah added a comment - Patch for SHINDIG-1227

          People

          • Assignee:
            Unassigned
            Reporter:
            Chirag Shah
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development