sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1657378 - in /sling/whiteboard/bdelacretaz/multisling2015: ./ resolver/ resolver/src/main/java/org/apache/sling/servlets/resolver/internal/ resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/ resolver/src/main/java/o...
Date Wed, 04 Feb 2015 19:17:49 GMT
Author: bdelacretaz
Date: Wed Feb  4 19:17:48 2015
New Revision: 1657378

URL: http://svn.apache.org/r1657378
Log:
SLING-4386 - tenant-specific script search paths work, very basic MultitenantServletResolver
for now

Added:
    sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/multitenant/
    sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/multitenant/MultitenantServletResolver.java
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/homepage/
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/homepage/homepage.esp
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/page/
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/page/page.esp
Removed:
    sling/whiteboard/bdelacretaz/multisling2015/tenant-resolver/
Modified:
    sling/whiteboard/bdelacretaz/multisling2015/pom.xml
    sling/whiteboard/bdelacretaz/multisling2015/resolver/pom.xml
    sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
    sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
    sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java
    sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java
    sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java
    sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/apps/blog/page/page.esp
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/content/T/example.com.json
    sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v42/scripts/blog/page/page.esp

Modified: sling/whiteboard/bdelacretaz/multisling2015/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/pom.xml?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/pom.xml (original)
+++ sling/whiteboard/bdelacretaz/multisling2015/pom.xml Wed Feb  4 19:17:48 2015
@@ -14,7 +14,7 @@
     <name>Apache Sling MultiSling 2015 prototype - Reactor</name>
 
     <modules>
-        <module>tenant-resolver</module>
+        <module>cdtenants</module>
         <module>test-content</module>
         <module>resolver</module>
     </modules>

Modified: sling/whiteboard/bdelacretaz/multisling2015/resolver/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/resolver/pom.xml?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/resolver/pom.xml (original)
+++ sling/whiteboard/bdelacretaz/multisling2015/resolver/pom.xml Wed Feb  4 19:17:48 2015
@@ -120,6 +120,13 @@
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
+        <dependency>
+			<groupId>org.apache.sling</groupId>
+			<artifactId>org.apache.sling.ms2015.cdtenants</artifactId>
+			<version>0.1.1-SNAPSHOT</version>
+			<scope>provided</scope>
+        </dependency>
+        
     <!-- Testing -->
         <dependency>
             <groupId>org.apache.sling</groupId>

Modified: sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
Wed Feb  4 19:17:48 2015
@@ -83,6 +83,7 @@ import org.apache.sling.api.servlets.Ser
 import org.apache.sling.commons.osgi.OsgiUtil;
 import org.apache.sling.engine.ResponseUtil;
 import org.apache.sling.engine.servlets.ErrorHandler;
+import org.apache.sling.ms2015.cdtenants.ContentDrivenTenant;
 import org.apache.sling.servlets.resolver.internal.defaults.DefaultErrorHandlerServlet;
 import org.apache.sling.servlets.resolver.internal.defaults.DefaultServlet;
 import org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector;
@@ -92,6 +93,7 @@ import org.apache.sling.servlets.resolve
 import org.apache.sling.servlets.resolver.internal.resource.ServletResourceProvider;
 import org.apache.sling.servlets.resolver.internal.resource.ServletResourceProviderFactory;
 import org.apache.sling.servlets.resolver.jmx.SlingServletResolverCacheMBean;
+import org.apache.sling.servlets.resolver.multitenant.MultitenantServletResolver;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
@@ -216,6 +218,8 @@ public class SlingServletResolver
     private String[] defaultExtensions;
 
     private ServletResolverWebConsolePlugin plugin;
+    
+    private MultitenantServletResolver multitenantServletResolver;
 
     // ---------- ServletResolver interface -----------------------------------
 
@@ -224,7 +228,7 @@ public class SlingServletResolver
      */
     public Servlet resolveServlet(final SlingHttpServletRequest request) {
         final Resource resource = request.getResource();
-
+        
         // start tracking servlet resolution
         final RequestProgressTracker tracker = request.getRequestProgressTracker();
         final String timerName = "resolveServlet(" + resource + ")";
@@ -234,12 +238,17 @@ public class SlingServletResolver
         if (LOGGER.isDebugEnabled()) {
             LOGGER.debug("resolveServlet called for resource {}", resource);
         }
-
-        final ResourceResolver scriptResolver = this.getScriptResourceResolver();
+        
         Servlet servlet = null;
+        
+        if(multitenantServletResolver.canResolve(resource)) {
+            servlet = multitenantServletResolver.resolveServlet(request);
+        } else {
+            final ResourceResolver scriptResolver = this.getScriptResourceResolver();
 
-        if ( type != null && type.length() > 0 ) {
-            servlet = resolveServletInternal(request, null, type, scriptResolver);
+            if ( type != null && type.length() > 0 ) {
+                servlet = resolveServletInternal(request, null, type, scriptResolver);
+            }
         }
 
         // last resort, use the core bundle default servlet
@@ -280,8 +289,14 @@ public class SlingServletResolver
             LOGGER.debug("resolveServlet called for resource {} with script name {}", resource,
scriptName);
         }
 
-        final ResourceResolver scriptResolver = this.getScriptResourceResolver();
-        final Servlet servlet = resolveServletInternal(null, resource, scriptName, scriptResolver);
+        Servlet servlet = null;
+        
+        if(multitenantServletResolver.canResolve(resource)) {
+            servlet = multitenantServletResolver.resolveServlet(resource, scriptName);
+        } else {
+            final ResourceResolver scriptResolver = this.getScriptResourceResolver();
+            servlet = resolveServletInternal(null, resource, scriptName, scriptResolver);
+        }
 
         // log the servlet found
         if (LOGGER.isDebugEnabled()) {
@@ -306,6 +321,7 @@ public class SlingServletResolver
             LOGGER.debug("resolveServlet called for for script name {}", scriptName);
         }
 
+        // TODO cannot use the MultitenantServletResolver as we don't have a Resource
         final ResourceResolver scriptResolver = this.getScriptResourceResolver();
         final Servlet servlet = resolveServletInternal(null, (Resource)null, scriptName,
scriptResolver);
 
@@ -632,7 +648,7 @@ public class SlingServletResolver
             return scriptServlet;
         }
 
-        final Collection<Resource> candidates = locationUtil.getServlets(resolver);
+        final Collection<Resource> candidates = locationUtil.getServlets(resolver,
null);
 
         if (LOGGER.isDebugEnabled()) {
             if (candidates.isEmpty()) {
@@ -836,6 +852,7 @@ public class SlingServletResolver
             }
         }
         this.defaultExtensions = OsgiUtil.toStringArray(properties.get(PROP_DEFAULT_EXTENSIONS),
DEFAULT_DEFAULT_EXTENSIONS);
+        this.multitenantServletResolver = new MultitenantServletResolver(this.defaultExtensions);
 
         // create cache - if a cache size is configured
         this.cacheSize = OsgiUtil.toInteger(properties.get(PROP_CACHE_SIZE), DEFAULT_CACHE_SIZE);
@@ -1257,7 +1274,7 @@ public class SlingServletResolver
                                 defaultExtensions,
                                 method,
                                 requestPathInfo.getSelectors());
-                        servlets = locationUtil.getServlets(resourceResolver);
+                        servlets = locationUtil.getServlets(resourceResolver, null);
                     }
                     tr(pw);
                     tdLabel(pw, "&nbsp;");

Modified: sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
Wed Feb  4 19:17:48 2015
@@ -64,11 +64,11 @@ public abstract class AbstractResourceCo
         this.executionPaths = executionPaths;
     }
 
-    public final Collection<Resource> getServlets(final ResourceResolver resolver)
{
+    public final Collection<Resource> getServlets(final ResourceResolver resolver,
String [] forcedSearchPath) {
 
         final SortedSet<Resource> resources = new TreeSet<Resource>();
         final Iterator<String> locations = new LocationIterator(resourceType, resourceSuperType,
-                                                                baseResourceType, resolver);
+                                                                baseResourceType, resolver,
forcedSearchPath);
         while (locations.hasNext()) {
             final String location = locations.next();
 

Modified: sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/LocationIterator.java
Wed Feb  4 19:17:48 2015
@@ -98,11 +98,11 @@ public class LocationIterator implements
      * @param resolver The resource resolver
      */
     public LocationIterator(String resourceType, String resourceSuperType, String baseResourceType,
-            ResourceResolver resolver) {
+            ResourceResolver resolver, String [] forcedSearchPath) {
         this.resolver = resolver;
         this.baseResourceType = baseResourceType;
 
-        String[] tmpPath = resolver.getSearchPath();
+        String[] tmpPath = forcedSearchPath != null ? forcedSearchPath : resolver.getSearchPath();
         if (tmpPath == null || tmpPath.length == 0) {
             tmpPath = new String[] { "/" };
         }

Added: sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/multitenant/MultitenantServletResolver.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/multitenant/MultitenantServletResolver.java?rev=1657378&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/multitenant/MultitenantServletResolver.java
(added)
+++ sling/whiteboard/bdelacretaz/multisling2015/resolver/src/main/java/org/apache/sling/servlets/resolver/multitenant/MultitenantServletResolver.java
Wed Feb  4 19:17:48 2015
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.servlets.resolver.multitenant;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.servlet.Servlet;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.request.RequestProgressTracker;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.ms2015.cdtenants.ContentDrivenTenant;
+import org.apache.sling.servlets.resolver.internal.helper.ResourceCollector;
+
+/** Prototype ServletResolver used for content resources
+ *  that adapt to a ContentDrivenTenant
+ */
+public class MultitenantServletResolver {
+
+    private String[] defaultExtensions;
+    
+    public MultitenantServletResolver(String [] defaultExtensions) {
+        this.defaultExtensions = defaultExtensions;
+    }
+    
+    public boolean canResolve(Resource r) {
+        return r.adaptTo(ContentDrivenTenant.class) != null;
+    }
+    
+    public Servlet resolveServlet(Resource r, String scriptName) {
+        throw new UnsupportedOperationException("resolving with script names is not implemented
yet");
+    }
+
+    public Servlet resolveServlet(SlingHttpServletRequest request) {
+        final RequestProgressTracker rpt = request.getRequestProgressTracker();
+        
+        final Resource resource = request.getResource();
+        // TODO cache the canResolve adaptTo result?
+        final ContentDrivenTenant t = resource.adaptTo(ContentDrivenTenant.class);
+        if(t == null) {
+            throw new IllegalStateException("Resource does not adapt to ContentDrivenTenant:"
+ resource); 
+        }
+        
+        rpt.log(t.toString());
+        
+        // TODO should use a script-specific ResourceResolver - for now we assume current
+        // user can read the scripts
+        final ResourceResolver scriptResolver = resource.getResourceResolver();
+        
+        Servlet result = null;
+        final ResourceCollector rc = ResourceCollector.create(request,  t.getSearchPath(),
defaultExtensions);
+        
+        // For now, simply return the first servlet found
+        // TODO handle OptingServlets, refactor code from SlingServletResolver
+        final Collection<Resource> candidates = rc.getServlets(scriptResolver, t.getSearchPath());
+        rpt.log("Found {0} Servlet candidates", candidates.size());
+        final Iterator<Resource> it = candidates.iterator();
+        if(it.hasNext()) {
+            final Resource sr = it.next(); 
+            result = sr.adaptTo(Servlet.class);
+            if(result == null) {
+                throw new IllegalStateException("Resource does not adapt to Servlet:" + sr);
+            }
+        }
+        
+        rpt.log("Resolved servlet: {0}", result.toString());
+        return result;
+    }   
+}
\ No newline at end of file

Modified: sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/LocationIteratorTest.java
Wed Feb  4 19:17:48 2015
@@ -37,7 +37,7 @@ public class LocationIteratorTest extend
         final LocationIterator li = new LocationIterator(resourceType,
                 resourceSuperType,
                 baseResourceType,
-                this.resourceResolver);
+                this.resourceResolver, null);
         return li;
     }
 

Modified: sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ResourceCollectorTest.java
Wed Feb  4 19:17:48 2015
@@ -271,7 +271,7 @@ public class ResourceCollectorTest exten
         }
 
         ResourceCollector lu = ResourceCollector.create(request, null, new String[] {"html"});
-        Collection<Resource> res = lu.getServlets(request.getResourceResolver());
+        Collection<Resource> res = lu.getServlets(request.getResourceResolver(), null);
         Iterator<Resource> rIter = res.iterator();
 
         for (int index : indices) {

Modified: sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java
Wed Feb  4 19:17:48 2015
@@ -69,7 +69,7 @@ public class ScriptSelectionTest extends
         // Create mock request and get scripts from ResourceCollector
         final MockSlingHttpServletRequest req = makeRequest(method, selectors, extension);
         final ResourceCollector u = ResourceCollector.create(req, null, new String[] {"html"});
-        final Collection<Resource> s = u.getServlets(req.getResourceResolver());
+        final Collection<Resource> s = u.getServlets(req.getResourceResolver(), null);
 
         if(expectedScript == null) {
             assertFalse("No script must be found", s.iterator().hasNext());

Modified: sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/apps/blog/page/page.esp
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/apps/blog/page/page.esp?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/apps/blog/page/page.esp
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/apps/blog/page/page.esp
Wed Feb  4 19:17:48 2015
@@ -1,6 +1,6 @@
 <html>
 <%
-var t = resource.adaptTo(Packages.org.apache.sling.tenant.Tenant);
+var t = resource.adaptTo(Packages.org.apache.sling.ms2015.cdtenants.ContentDrivenTenant);
 %>
 <body>
 <p>
@@ -10,7 +10,7 @@ This is the default /apps rendering for
 The current Resource is <b><%= resource %></b>.
 </p>
 <p>
-The current Tenant is <b><%= t %></b>.
+The current ContentDrivenTenant is <b><%= t %></b>.
 </p>
 <body>
 </html>
\ No newline at end of file

Modified: sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/content/T/example.com.json
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/content/T/example.com.json?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/content/T/example.com.json
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/content/T/example.com.json
Wed Feb  4 19:17:48 2015
@@ -9,6 +9,7 @@
     },
     "subsite" : {
         "sling:tenantRoot" : "true",
+        "sling:resourceType" : "blog/homepage",
         "somepage" : {
             "sling:resourceType" : "blog/page",
             "jcr:title" : "This is somepage from the example.com/subsite tenant"

Modified: sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v42/scripts/blog/page/page.esp
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v42/scripts/blog/page/page.esp?rev=1657378&r1=1657377&r2=1657378&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v42/scripts/blog/page/page.esp
(original)
+++ sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v42/scripts/blog/page/page.esp
Wed Feb  4 19:17:48 2015
@@ -1,16 +1,14 @@
 <html>
 <%
-var t = resource.adaptTo(Packages.org.apache.sling.tenant.Tenant);
+var t = resource.adaptTo(Packages.org.apache.sling.ms2015.cdtenants.ContentDrivenTenant);
 %>
-<body color="blue">
-<p>
-This is the V42 blog/page rendering.
-</p>
+<body>
+<h1 style="color:blue">This is the V42 blog/page rendering</h1>
 <p>
-The current Resource is <b><%= resource %></b>.
+The current Resource is <b><%= resource %></b>, resourceType <b><%=
resource.getResourceType() %></b>.
 </p>
 <p>
-The current Tenant is <b><%= t %></b>.
+The current ContentDrivenTenant is <b><%= t %></b>.
 </p>
 <body>
 </html>
\ No newline at end of file

Added: sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/homepage/homepage.esp
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/homepage/homepage.esp?rev=1657378&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/homepage/homepage.esp
(added)
+++ sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/homepage/homepage.esp
Wed Feb  4 19:17:48 2015
@@ -0,0 +1,14 @@
+<html>
+<%
+var t = resource.adaptTo(Packages.org.apache.sling.ms2015.cdtenants.ContentDrivenTenant);
+%>
+<body>
+<h1 style="color:green">Custom V43 blog/homepage rendering</h1>
+<p>
+The current Resource is <b><%= resource %></b>, resourceType <b><%=
resource.getResourceType() %></b>.
+</p>
+<p>
+The current ContentDrivenTenant is <b><%= t %></b>.
+</p>
+<body>
+</html>
\ No newline at end of file

Added: sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/page/page.esp
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/page/page.esp?rev=1657378&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/page/page.esp
(added)
+++ sling/whiteboard/bdelacretaz/multisling2015/test-content/src/main/resources/SLING-CONTENT/modules/blog/v43/scripts/blog/page/page.esp
Wed Feb  4 19:17:48 2015
@@ -0,0 +1,14 @@
+<html>
+<%
+var t = resource.adaptTo(Packages.org.apache.sling.ms2015.cdtenants.ContentDrivenTenant);
+%>
+<body>
+<h1 style="color:red">Now for the V43 blog/page rendering</h1>
+<p>
+The current Resource is <b><%= resource %></b>, resourceType <b><%=
resource.getResourceType() %></b>.
+</p>
+<p>
+The current ContentDrivenTenant is <b><%= t %></b>.
+</p>
+<body>
+</html>
\ No newline at end of file



Mime
View raw message