Apache
Home » Documentation » Bundles

Bundle Resources (extensions.bundleresource)

Introduction

The Bundle Resource Provider provides access to files/directories included in an OSGi bundle through the Sling ResourceResolver.

Resource Types

Files and directories are mapped into the resource tree as regular Resource instances whose resource type depends on the actual nature of the mapped resource:

Adapters

Filesystem resources extend from Sling's AbstractResource class and thus are adaptable to any type for which an AdapterFactory is registered supporting bundle resources. In addition BundleResource support the following adapters natively:

Configuration

Providing bundles have a Bundle manifest header Sling-Bundle-Resources containing a list of absolute paths provided by the bundle. The paths are separated by comma or whitespace (SP, TAB, VTAB, CR, LF).

Example (manifest.mf):

...
Sling-Bundle-Resources: /libs/sling/explorer,                         
    /libs/sling/servlet/default/explorer
...

It's also possible to map resources from the bundle to a different location in the resource tree. In this case the path has to be extended with a path attrribute to declare where the resources are in the bundle:

...
Sling-Bundle-Resources: /somepath/inthe/resourcetree;path:=/path/inthe/bundle
...

The Bundle Resource Provider also has a web console plugin through which the currently installed bundles can be seen.

Rev. 1341376 by fmeschbe on Tue, 22 May 2012 09:41:06 +0000
Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.