incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Sling Website > Bundle Resources (extensions.bundleresource)
Date Mon, 23 Aug 2010 07:01:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="">Bundle
Resources (extensions.bundleresource)</a></h2>
    <h4>Page  <b>added</b> by             <a href="">Mike
    <div class="notificationGreySide">
         <h1><a name="BundleResources%28extensions.bundleresource%29-BundleResources"></a>Bundle

    <li><a href='#BundleResources%28extensions.bundleresource%29-Introduction'>Introduction</a></li>
    <li><a href='#BundleResources%28extensions.bundleresource%29-ResourceTypes'>Resource
    <li><a href='#BundleResources%28extensions.bundleresource%29-Adapters'>Adapters</a></li>
    <li><a href='#BundleResources%28extensions.bundleresource%29-Configuration'>Configuration</a></li>

<h2><a name="BundleResources%28extensions.bundleresource%29-Introduction"></a>Introduction</h2>

<p>The Bundle Resource Provider provides access to files/directories included in a OSGi
bundle through the Sling <tt>ResourceResolver</tt>. </p>

<h2><a name="BundleResources%28extensions.bundleresource%29-ResourceTypes"></a>Resource

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

	<li>Regular files are assigned the <tt>nt:file</tt> resource type</li>
	<li>Directories are assigned the <tt>nt:folder</tt> resource type</li>

<h2><a name="BundleResources%28extensions.bundleresource%29-Adapters"></a>Adapters</h2>

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

	<li><tt></tt> &#8211; A valid <tt>bundle://</tt>
URL to the resource in the bundle.</li>
	<li><tt></tt> &#8211; An <tt>InputStream</tt>
to read from the file is returned (only for files, not for directories).</li>

<h2><a name="BundleResources%28extensions.bundleresource%29-Configuration"></a>Configuration</h2>

<p>Providing bundles have a Bundle manifest header <tt>Sling-Bundle-Resources</tt>
containing a list of absolute path prefixes provided by the bundle and the correspondent path
in the resource tree. The two path are separated by comma or whitespace (SP, TAB, VTAB, CR,
LF), the list entries are separated by semicolon.</p>

<p>Example (</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
Sling-Bundle-Resources: /libs/sling/explorer,                         
    /libs/sling/servlet/<span class="code-keyword">default</span>/explorer

<p>The Bundle Resource Provider also has a web console plugin, thus the configuration
can be seen and edited in the web console.</p>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message