Remote JS files given as portlet dependencies in gatein-resources.xml not working

90 views Asked by At

I want to use http://maps.google.com/maps/api/js in a portlet having name Banner

for that in gatein-resources.xml i have declaired it as a shaired resource with name googlemap and add googlemap as dependencies of Banner portlet

<scripts>
    <name>googlemap</name>
    <url>http://maps.google.com/maps/api/js</url>
</scripts> 



<portlet>
    <name>
        Banner
     </name>
    <scripts>
        <depends>
            <scripts>googlemap</scripts>
        </depends>
    </scripts>
</portlet> 

But while loading Banner portlet map is not showing.

If i am declareing http://maps.google.com/maps/api/js file inside script tag in the
jsp file used in Banner portlet, google map is showing.

Can anybody explain why googlemap js is not loading when declared it inside gatein-resources.xml.
All the other scripts reside in local system itself declared in gateing-resources are working fine.

1

There are 1 answers

0
tmarwen On

First there might be an error in your module declaration since the module declaration does not fit in the gatrein-resources xsd schmea declaration. It should be something like the following:

<portlet>
  <name>Banner</name>
  <module>
    <depends>
      <module>googlemap</module>
    </depends>
  </module>
</portlet>

<module>
  <name>googlemap</name>
  <script>
    <path>/path/to/your/js/file.js</path>
  </script>
</module>

Meanwhile your should be aware that the AMD (Asynchrounous module defenition) engine of GateIn does not provide support for Content Delevery Network (CDN) files and you have to provide a path referring to a local file under your webapp archive and not not a remote one.

As far as I know, GateIn people have planned working on supporting CDN path files in an upcoming release.