shale-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ed Burns (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SHALE-183) Shale Remoting doesn't support linking Javascript of popular javascript libraries.
Date Sun, 06 Aug 2006 02:24:21 GMT
    [ http://issues.apache.org/struts/browse/SHALE-183?page=comments#action_37919 ] 
            
Ed Burns commented on SHALE-183:
--------------------------------

* On startup, shale-remoting calls
  ClassLoader.getResources("META-INF/shale-remoting-resource-library.json")
  and does the following for each URL returned:

  - Get an input stream on the URL and read it into a buffer

  - Parse the buffer as JSON and convert it into a JSONObject.

  - The JSON object is typified by the following JavaScript

  var lib = {
     resourceIds: [ "prototype", "scriptaculous" ],
     prototype: {
       versions: [ "1.4.0", "1.2.0" ],
       "1.4.0": [ "1.4.0/prototype.js", "1.4.0/effects.js", "1.4.0/dragdrop.js", "1.4.0/controls.js"
],
       "1.2.0": [ "1.2.0/prototype.js", "1.2.0/effects.js", "1.2.0/dragdrop.js", "1.2.0/controls.js"
]
     },
     scriptaculous: { ... }
  };

  - In other words, the top level object will have the following keys:

    resourceIds: an array of the shale XhtmlHelper resourceId values
    under which that library will be exposed.  For each element in that
    array, there will be a top level key that is a JavaScript object
    with the following structure:

      versions: this is an array of strings corresponding to the version
      number of the library.  For each element in this array, there will
      be a top level key, called <VERSION_KEY> for discussion.

      <VERSION_KEY>: this is an array of strings that comprise the
      required resourceIds of this library, prefixed by the version
      number.  Each element is this array is the actual path in this jar
      file to the resource file.

    This simple structure enables packaging multiple libraries, and
    multiple versions of each library, into a single jar.

  - Parse the JSON object into an internal data structure that exposes
    the salient resources.

* When someone calls for one of these resources, for example, by doing

  xhtmlHelper.linkJavaScript(context, comp, writer, 
                             Mechanism.CLASS_RESOURCE, "prototype", "1.4.0");

  the data structure will be consulted and <script src=""> elements will
  be rendered that will resolve to the values in the <VERSION_KEY> array
  for that library.

> Shale Remoting doesn't support linking Javascript of popular javascript libraries.
> ----------------------------------------------------------------------------------
>
>                 Key: SHALE-183
>                 URL: http://issues.apache.org/struts/browse/SHALE-183
>             Project: Shale
>          Issue Type: Improvement
>          Components: Remoting
>            Reporter: Ed Burns
>
> I would like to have an enhancement to XhtmlHelper.linkJavascript() that supported many
different popular JavaScript libraries.  For example, I'd like to do something like:
> getXhtmlHelper().linkJavascript(context, component, writer,
>                         Mechanism.CLASS_RESOURCE, "dojo", "0.3.0");
> getXhtmlHelper().linkJavascript(context, component, writer,
>                         Mechanism.CLASS_RESOURCE, "prototype", "1.4.0");
> getXhtmlHelper().linkJavascript(context, component, writer,
>                         Mechanism.CLASS_RESOURCE, "scriptaculous", "1.6.1");
> And rest assured in the knowledge that the proper script elemnets will be rendered out
iff no-one else on this request has asked for these scripts to be rendered.  
> If we make jMaki and jsf-extensions use this, then we can save a lot of code and bandwidth.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message