Author: buildbot Date: Thu May 21 08:25:18 2015 New Revision: 952158 Log: Staging update by buildbot for sling
Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/models.html Propchange: websites/staging/sling/trunk/content/ ------------------------------------------------------------------------------ --- cms:source-revision (original) +++ cms:source-revision Thu May 21 08:25:18 2015 @@ -1 +1 @@ -1680706 +1680762 Modified: websites/staging/sling/trunk/content/documentation/bundles/models.html ============================================================================== --- websites/staging/sling/trunk/content/documentation/bundles/models.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/models.html Thu May 21 08:25:18 2015 @@ -205,7 +205,8 @@ can be listed in a comma-separated list <p>As with other AdapterFactories, if the adaptation can't be made for any reason, <code>adaptTo()</code> returns null.</p> <h2 id="modelfactory-since-120">ModelFactory (since 1.2.0)</h2> -<p>Since Sling Models 1.2.0 (<a href="https://issues.apache.org/jira/browse/SLING-3709">SLING-3709</a>) there is another way of instantiating models. The OSGi service <code>ModelFactory</code> provides a method for instantiating a model that throws exceptions this is not possible. That way <code>null</code> checks are not necessary.</p> +<p><em>See also <a href="https://issues.apache.org/jira/browse/SLING-3709">SLING-3709</a></em></p> +<p>Since Sling Models 1.2.0 there is another way of instantiating models. The OSGi service <code>ModelFactory</code> provides a method for instantiating a model that throws exceptions. This is not allowed by the Javadoc contract of the adaptTo method. That way <code>null</code> checks are not necessary and it is easier to see why instantiation of the model failed.</p> <div class="codehilite"><pre><span class="k">try</span> <span class="o">{</span> <span class="n">MyModel</span> <span class="n">model</span> <span class="o">=</span> <span class="n">modelFactory</span><span class="o">.</span><span class="na">createModel</span><span class="o">(</span><span class="n">resource</span><span class="o">,</span> <span class="n">MyModel</span><span class="o">.</span><span class="na">class</span><span class="o">);</span> <span class="o">}</span> <span class="k">catch</span> <span class="o">(</span><span class="n">Exception</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span> @@ -558,7 +559,7 @@ Validation is only supported on models w <td>2500</td> <td>1.1.0</td> <td>Injects a resource by its path.</td> -<td><code>Resource</code> or <code>SlingHttpRequest</code> objects</td> +<td><code>Resource</code> or <code>SlingHttpServletRequest</code> objects</td> <td>yes</td> <td>none</td> <td>none</td> @@ -579,8 +580,8 @@ Validation is only supported on models w <td><code>sling-object</code></td> <td><code>Integer.MAX_VALUE</code></td> <td>1.1.0</td> -<td>Injects commonly used sling objects if the field matches with the class: request, response, resource resolver, current resource, SlingScriptHelper</td> -<td><code>Resource</code>, <code>ResourceResolver</code> or <code>SlingHttpRequest</code> objects</td> +<td>Injects commonly used sling objects if the field matches with the class: request, response, resource resolver, current resource, SlingScriptHelper. This works only if the adaptable can get the according information, i.e. all objects are available via <code>SlingHttpServletRequest</code> while <code>ResourceResolver</code> can only resolve the <code>ResourceResolver</code> object and nothing else</td> +<td><code>Resource</code>, <code>ResourceResolver</code> or <code>SlingHttpServletRequest</code> objects</td> <td>yes</td> <td>none</td> <td>none</td> @@ -677,7 +678,7 @@ SPI interface which could use context to content path context. If multiple implementations of the <code>ImplementationPicker</code> interface are present, they are queried one after another in order of their service ranking property, the first one that picks an implementation wins.</p> <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;"> - Rev. 1672077 by justin on Wed, 8 Apr 2015 12:34:57 +0000 + Rev. 1680762 by kwin on Thu, 21 May 2015 08:25:05 +0000 </div> <div class="trademarkFooter"> Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project