Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] modularized non-Java web content


Recently there was a bug report about some dojo stuff not working well with our http service.  That prompted me to try it out and indeed there is a problem.  In any event, in the process of trying this I got dojo and started to play.  I was not happy with the idea that I would put the dojo libs in my actual application bundle since many different apps deployed to the same server might use dojo.  Furthermore, I assume that browsers are not smart enough to handle the same libs at many different URLs in any sort of optimal way.  So I make a dojo bundle that included
  <extension point="org.eclipse.equinox.http.registry.resources">
    <resource alias="/dojo" base-name="/dojo-0.4.0-ajax"/>
  </extension>

Now an dojo-based bundle can contribute content wherever it wants and include something like
        <script type="text/_javascript_" src="">
This seems to work fine.

This got me to thinking about modularized, non-Java web content.  For example, what if there are multiple versions of dojo on the server and different apps that need the different dojo versions.  We could have declared the dojo alias to be /dojo-0.4.0 and have apps reference it but then the app would be tightly bound to that version of dojo.

Then I though of having some sort of variable that would be bound to the right version of dojo.  for example,
        <script type="text/_javascript_" src="">
and then dojo_base is set to the appropriate URL fragment.  This is better but in and of itself feels quite brittle and would require quite a bit of maintenance.

So then I thought, is there some way we can use the OSGi dependency mechanism to handle this?  For example, I have a dojo bundle (called "dojo" with version 0.4.0 that surfaces the dojo function at a particular (set of) URL.  My application bundle could spec a dependency
        Require-Bundle: dojo; version=[0.4.0,0.5.0)        (whatever)
and then if we could manage to have the dojo references in my app's content replaced with the appropriate references as surfaced by the dojo bundle, we'd be rockin.

In a certain light this is like having a dojo service registered in URL space and wanting to access it from HTML/_javascript_ content.

Is there any precedence for this?  Other systems that do such things?  mechanisms that we could leverage?  Is this just a goofy idea?

Jeff

Back to the top