You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2008/05/09 12:14:55 UTC

[jira] Resolved: (SLING-428) [Javascript] allow Server-side inclusion of Javascript files

     [ https://issues.apache.org/jira/browse/SLING-428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-428.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

I applied the patch with some modifications in Rev. 654747:

(1) The SlingGlobal is initialized as part of the global root scope initialization done by the JavaScriptEngineFactory.
(2) The load method contains the following extensions:
        * supports script paths relative to the current (request) script
        * (if the relative path cannot be resolved relative to the current script it is still tried to be resolved through the ResourceResolver using the search path).
        * if the script name ends with ".esp" it is loaded through the EspReader

Thanks for reporting and providing a patch.

Please close this issue if it solves your needs. Thanks.

> [Javascript] allow Server-side inclusion of Javascript files
> ------------------------------------------------------------
>
>                 Key: SLING-428
>                 URL: https://issues.apache.org/jira/browse/SLING-428
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Lars Trieloff
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>         Attachments: SLING-428.patch
>
>
> For the sake of modularizing server-side Javascript libraries, it is advisable to have an inclusion mechanism. Javascript does not have an standardized way of handling inclusions, so I propose to use the conventions established by the Rhino Javascript Shell (http://www.mozilla.org/rhino/shell.html) which is introducing a load() function in the global scope, loading and evaluating a Javascript file in the current scope.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.