incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > Bundle Resources (extensions.bundleresource)
Date Mon, 23 Aug 2010 07:01:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<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="https://cwiki.apache.org/confluence/display/SLINGxSITE/Bundle+Resources+%28extensions.bundleresource%29">Bundle
Resources (extensions.bundleresource)</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://cwiki.apache.org/confluence/display/~mykee">Mike
Mueller</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="BundleResources%28extensions.bundleresource%29-BundleResources"></a>Bundle
Resources</h1>

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

<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
Types</h2>

<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>

<ul>
	<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>
</ul>



<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>

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



<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 (manifest.mf):</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
...
</pre>
</div></div>

<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>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Bundle+Resources+%28extensions.bundleresource%29">View
Online</a>
              |
       <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Bundle+Resources+%28extensions.bundleresource%29?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message