ICEfaces
  1. ICEfaces
  2. ICE-7687

Add ability to avoid having the ice:gmap JavaScript load on every page when not using it.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 3.0
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      ICEfaces 3, ice:gmap component
    • Assignee Priority:
      P1
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Compatibility/Configuration

      Description

      Currently, the Google gmap bootstrap JavaScript used by the ice:gmap component must be loaded into the <head> region of the page when the page loads. Due to technical limitations with JSF partial-page updates not being able to update the HEAD region we preload the Javascript into the head on every full page GET so that it is there should the ice:gmap component be added to the page later via a partial-page update.

      However, this preloading is not efficient as it causes the gmap JavaScript to be loaded and evaluated each time a page is loaded, even if the component is not being used on that page. This JIRA is to add a mechanism (config. param?) that would allow the application to opt. out of the gmap Javascript preload if that component is not being used.

      A similar issue was recently resolved for ice:inputRichText via ICE-7293.

        Issue Links

          Activity

          Hide
          Mircea Toma added a comment -

          Annotated GMapRenderer as mandatory resource. Moved ExternalScript annotation to the component and changed its processing to be executed with the rest of mandatory resource dependencies. Renamed ExternalScript to ExternalResourceDependency. Updated component-showcase web.xml to include GMap component in the list of mandatoryResourceConfiguration parameter.

          Show
          Mircea Toma added a comment - Annotated GMapRenderer as mandatory resource. Moved ExternalScript annotation to the component and changed its processing to be executed with the rest of mandatory resource dependencies. Renamed ExternalScript to ExternalResourceDependency. Updated component-showcase web.xml to include GMap component in the list of mandatoryResourceConfiguration parameter.
          Hide
          Mircea Toma added a comment -

          Changed strategy used to insert Google Maps script code into the 'head'. Created dummy/empty gmap.js resource and referenced by GMap component. Introduced GMapResourceHandler which replaces dynamically gmap.js' request URL with the URL pointing to Google code.

          Show
          Mircea Toma added a comment - Changed strategy used to insert Google Maps script code into the 'head'. Created dummy/empty gmap.js resource and referenced by GMap component. Introduced GMapResourceHandler which replaces dynamically gmap.js' request URL with the URL pointing to Google code.
          Hide
          Ken Fyten added a comment -

          After testing this change, it is clear that we will still want the old behaviour of being able to "Switch-off" the loading of gmap JS if there is no gmap key present in the web.xml file. The reason for this is that if you have an application where mandatoryResource="all", and you are not using the gmap component, it will still attempt to load it and you will see a nasty popup alert from Google complaining about the gmap key.

          So basically, the mandatory resource impl. for ice:gmap should internally check for the gmap key in the web.xml, and bail on loading if it isn't present.

          Show
          Ken Fyten added a comment - After testing this change, it is clear that we will still want the old behaviour of being able to "Switch-off" the loading of gmap JS if there is no gmap key present in the web.xml file. The reason for this is that if you have an application where mandatoryResource="all", and you are not using the gmap component, it will still attempt to load it and you will see a nasty popup alert from Google complaining about the gmap key. So basically, the mandatory resource impl. for ice:gmap should internally check for the gmap key in the web.xml, and bail on loading if it isn't present.
          Hide
          Mircea Toma added a comment -

          Changed GMapResourceHandler to disable Google Maps code loading when key is not provided.

          Show
          Mircea Toma added a comment - Changed GMapResourceHandler to disable Google Maps code loading when key is not provided.

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Ken Fyten
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: