Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Using the Aggregator

chuckdumont edited this page Oct 18, 2012 · 2 revisions

In order to utilize the Aggregator, your application must use an AMD loader to asynchronously load the modules of your applicaiton, and the AMD loader must support the loader extension API [add link]. The loader shipped with Dojo 1.7.3 and Dojo 1.8 is such a loader.

Perform the following steps to configure your AMD based application to use the Aggregator:

Note that the client-side AMD config, the loader extension JavaScript and the AMD loader must be loaded into the browser in the indicated order. To bypass the Aggregator and load the application normally, simply skip the step of loading the loader extension JavaScript.

Using the Aggregator to boostrap the application

The Aggregator can be used to load the client-side AMD config, the loader extension JavaScript and the AMD loader. Normally, the Aggregator requests are performed by the loader extension JavaScript on behalf of the AMD loader. The requests sent to the Aggregator by the loader extension JavaScript use a path folding algorithm to specify the list of requested modules in order to conserve URL space. However, the Aggregator will accept the requested modules specified as a plain, comma separated, list in order to support hand-crafted requests used to boostrap the application. An example of a hand-crafted request used to boostrap an applicaton is:

<script src="/aggr?reqexp=true&modules=js%2Fconfig,combo%2FloaderExt,dojo%2Fdojo"></script>

In the above example, path separators in modules names have been replaced with the URL encoded representation (%2F). The example assumes that the application has defined a servlet using the alias /aggr in the plugin.xml for the application's bundle.

See the sample application for a working example of an AMD based application using the Aggregator. To load the sample application using the Aggregator, use the URL http:///testaggr/res/test.html. To load the application without using the Aggregator, use the URL http:///testaggr/test-no-aggr.html.