rave-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erin Noe-Payne <erin.noe.pa...@gmail.com>
Subject Re: resource placeholder
Date Thu, 12 Sep 2013 15:52:22 GMT
On Thu, Sep 12, 2013 at 11:36 AM, Matt Franklin
<m.ben.franklin@gmail.com> wrote:
> On Thu, Sep 12, 2013 at 11:33 AM, Michael Jett <mikesjett@gmail.com> wrote:
>
>> The require configuration has a place holder for osapi js.
>>
>> "osapi":"//placeholder.url.will.be.replaced.by.opensocial.environment"
>
>
>> At what point in the build process does this get replaced?
>>
>
> My guess is that it is during the page render.  In the JSP model, it pulls
> the current configuration (debug, etc) and renders out the shindig js url.
>
That's correct. This is in trunk, correct? In the angular branch I
believe we have just hard coded the url to point to the local shindig
instance, because the current workflow is not going to fly. The
backstory is...

The osapi script is served by the shindig server. Rave depends on a
shindig instance, but that is totally separate from rave and could be
hosted anywhere - locally on the same box (as it is by default when
you spin up), or remotely, or whatever. Rave knows the location of the
shindig server based on a java properties configuration file: see
portal.properties in the rave-portal module.

Then in the jsp (rave_js.tag line 43), there is a tag called:
<portal:render-script location="${'BEFORE_RAVE'}"/>

That tag drops in any script blocks that register themselves as before
rave. Specifically there is the class "OpensocialEnvironment", which
is registered as before rave (line 154). That class pulls the
properties we discussed, writes a script block of the format:
<script>requirejs.config({paths: {"osapi":"the/true/url"}});</script>

This happens AFTER the main config file is loaded onto the page, but
BEFORE any modules are required, and therefore overrides the
placeholder with the true location of the osapi scripts. Make
sense(ish)?

That is basically more complicated than it should be, and it's not
going to work in angular branch for two reasons.
1) The principled stand - we want logic out of this opaque jsps / java
classes building script blocks
2) Angular is loading requirejs with a data-main property, which means
the entire main.js and config is being loaded asynchronously, and both
the config and require() statements are in the same file. Even if you
don't care about #1, there is no longer a place to insert a script to
override the osapi property AFTER main config and BEFORE require() as
we are doing in trunk.

Ultimately we are going to need a new / cleaner strategy for getting
the config values from that properties file into the requirejs config
file.

>
>>
>> - Mike
>>

Mime
View raw message