You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2007/12/11 18:03:30 UTC

svn commit: r603302 - /incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java

Author: bdelacretaz
Date: Tue Dec 11 09:03:30 2007
New Revision: 603302

URL: http://svn.apache.org/viewvc?rev=603302&view=rev
Log:
SLING-133 - disable script resolution for Resources that wrap Property objects

Modified:
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java?rev=603302&r1=603301&r2=603302&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java (original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java Tue Dec 11 09:03:30 2007
@@ -28,6 +28,7 @@
 import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
+import javax.jcr.Property;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.servlet.ServletException;
@@ -162,6 +163,12 @@
         final Resource r = request.getResource();
         final Session s = (Session)request.getAttribute(Session.class.getName());
         MicroslingScript result = null;
+        
+        // SLING-133: do not resolve scripts for Properties, we want to use our default
+        // renderers for them (TODO: having that test here is really a temp fix)
+        if(r.adaptTo(Property.class) != null) {
+            return null;
+        }
 
         final String scriptFilename = scriptFilenameBuilder.buildScriptFilename(
             request.getMethod(),



Re: svn commit: r603302 - /incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Am Mittwoch, den 12.12.2007, 16:18 +0100 schrieb Bertrand Delacretaz:
> > But then: Why should such resources not be handled by any script (or
> > servlet) ?...
> 
> I'll try to explain that in my upcoming "chickens, eggs and stars"
> post (how's that for buzz building? ;-)

Looking forward to that one !

Regards
Felix


Re: svn commit: r603302 - /incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Dec 11, 2007 6:50 PM, Felix Meschberger <Fe...@day.com> wrote:
> Hi,
>
> Am Dienstag, den 11.12.2007, 17:03 +0000 schrieb bdelacretaz@apache.org:
> > +
> > +        // SLING-133: do not resolve scripts for Properties, we want to use our default
> > +        // renderers for them (TODO: having that test here is really a temp fix)
> > +        if(r.adaptTo(Property.class) != null) {
> > +            return null;
> > +        }
>
> While I honestly do not have a good solution, I am always weary of such
> special case handling....

I agree that it's somewhat ugly.

>
> But then: Why should such resources not be handled by any script (or
> servlet) ?...

I'll try to explain that in my upcoming "chickens, eggs and stars"
post (how's that for buzz building? ;-)

-Bertrand

Re: svn commit: r603302 - /incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java

Posted by Felix Meschberger <Fe...@day.com>.
Hi,

Am Dienstag, den 11.12.2007, 17:03 +0000 schrieb bdelacretaz@apache.org:
> +        
> +        // SLING-133: do not resolve scripts for Properties, we want to use our default
> +        // renderers for them (TODO: having that test here is really a temp fix)
> +        if(r.adaptTo(Property.class) != null) {
> +            return null;
> +        }

While I honestly do not have a good solution, I am always weary of such
special case handling.

But then: Why should such resources not be handled by any script (or
servlet) ?

Regards
Felix