|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.weborganic.bastille.web.GetWebBundles
public final class GetWebBundles
This generator returns the list of timestamped scripts and styles for a given service.
It will assemble and minimize the scripts and styles together as much as possible and return the list of bundles. Because the name each bundle includes unique stamp, they can be cached for a long periods. When files included in a bundle are modified, this generator will automatically produce a new bundle with a new stamp so that it results in a different URL.
Scripts are simply concatenated. Styles are concatenated and import rules will automatically include the imported styles into the main file.
Both styles and scripts can be minimised after the bundling. Minimized bundles will be saved using the
following extensions .min.js
and .min.css
. If files to be bundled already use the
*.min.*
extension, it will be considered to be already minimised and won't be minimised again.
Bundled files are automatically named as:
[bundlename]-[date]-[etag].[ext]
The bundle name is specified in the configuration; the date is the creation date of the bundle; the etag is the 4-character alphanumerical stamp; and the extension depends on the MIME type and minimization options.
This generator is highly configurable and the configuration properties are specific (but similar) for styles and scripts.
Properties pertaining to scripts and styles are prefixed by respectively bastille.jsbundler
and bastille.cssbundler
.
The minimize
property can be used to control minimization of the code.
The location
property can be used to define where the bundled files should be stored.
A bundle config defines the list of bundles to create. The "default" config is made of three bundles 'global', 'group', and 'service'.
Each bundle is specified using the bundles
property each bundle name is mapped to the list
of files to bundle, the {GROUP} and {SERVICE} values are automatically replaced by the Berlioz
service/group name in use.
The default configuration is the equivalent of:
<bastille>
<cssbundler minimize="true" location="/style/_/">
<configs default="global,group,service"/>
<bundles global="/style/global.css"
group="/style/{GROUP}.css"
service="/style/{GROUP}/{SERVICE}.css"/>
<datauris threshold="4096"/>
</cssbundler>
<jsbundler minimize="true" location="/script/_/">
<configs default="global,group,service"/>
<bundles global="/style/global.js"
group="/script/{GROUP}.js"
service="/script/{GROUP}/{SERVICE}.js"/>
</jsbundler>
</bastille>
No parameters are required for this generator, but the bundling can be disabled by setting the
berlioz-bundle
parameter to true
The XML returns the scripts and styles in the order in which they are defined.
<script src="[jslocation]/[bundle].js" bundled="[true|false]" minimized="[true|false]" />
...
<style src="[csslocation]/[bundle].css" bundled="[true|false]" minimized="[true|false]" />
...
Constructor Summary | |
---|---|
GetWebBundles()
|
Method Summary | |
---|---|
String |
getETag(ContentRequest req)
|
void |
process(ContentRequest req,
XMLWriter xml)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GetWebBundles()
Method Detail |
---|
public String getETag(ContentRequest req)
getETag
in interface Cacheable
public void process(ContentRequest req, XMLWriter xml) throws BerliozException, IOException
process
in interface ContentGenerator
BerliozException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |