incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1398589 - in /sling/trunk: bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/ bundles/scripting/jsp-taglib/src/main/resources/META-INF/ launchpad/builder/src/main/bundles/ launchpad/integration-tests/src/main...
Date Tue, 16 Oct 2012 00:54:42 GMT
Author: justin
Date: Tue Oct 16 00:54:42 2012
New Revision: 1398589

URL: http://svn.apache.org/viewvc?rev=1398589&view=rev
Log:
SLING-2621 - adding the sling:call tag

Added:
    sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/CallTag.java
  (with props)
    sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib12.tld   (with
props)
    sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/called-test.jsp
  (with props)
    sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/calling-test.jsp
  (with props)
Modified:
    sling/trunk/launchpad/builder/src/main/bundles/list.xml
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
    sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp

Added: sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/CallTag.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/CallTag.java?rev=1398589&view=auto
==============================================================================
--- sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/CallTag.java
(added)
+++ sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/CallTag.java
Tue Oct 16 00:54:42 2012
@@ -0,0 +1,177 @@
+/*
+ * 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.scripting.jsp.taglib;
+
+import javax.servlet.Servlet;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.BodyContent;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.request.RequestProgressTracker;
+import org.apache.sling.api.request.RequestUtil;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.api.scripting.SlingBindings;
+import org.apache.sling.api.scripting.SlingScriptHelper;
+import org.apache.sling.api.servlets.ServletResolver;
+import org.apache.sling.scripting.jsp.util.JspSlingHttpServletResponseWrapper;
+import org.apache.sling.scripting.jsp.util.TagUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The <code>CallTag</code> implements the
+ * <code>&lt;sling:call&gt;</code> custom tag.
+ */
+public class CallTag extends TagSupport {
+
+    private static final long serialVersionUID = 5446209582533607741L;
+
+    /**
+     * default logger
+     */
+    private static final Logger log = LoggerFactory.getLogger(CallTag.class);
+
+    /**
+     * jsp script
+     */
+    private String script;
+
+    /**
+     * flush
+     */
+    private boolean flush;
+
+    /**
+     * ignores the component hierarchy and only respect scripts paths
+     */
+    private boolean ignoreComponentHierarchy;
+
+    @Override
+    public int doEndTag() throws JspException {
+        final SlingBindings bindings = (SlingBindings) pageContext.getRequest().getAttribute(
+                SlingBindings.class.getName());
+        final SlingScriptHelper scriptHelper = bindings.getSling();
+        final ServletResolver servletResolver = scriptHelper.getService(ServletResolver.class);
+
+        final RequestProgressTracker tracker = TagUtil.getRequest(pageContext).getRequestProgressTracker();
+        String servletName = null;
+
+        final Servlet servlet;
+        if (!ignoreComponentHierarchy) {
+            final Resource resource = bindings.getResource();
+            servlet = servletResolver.resolveServlet(resource, this.script);
+
+            if (servlet != null) {
+                servletName = RequestUtil.getServletName(servlet);
+                tracker.log("Including script {0} for path={1}, type={2}: {3}", script, resource.getPath(),
+                        resource.getResourceType(), servletName);
+            }
+
+        } else {
+            final ResourceResolver resolver = bindings.getRequest().getResourceResolver();
+            final String scriptPath;
+            if (!script.startsWith("/")) {
+
+                // resolve relative script
+                String parentPath = ResourceUtil.getParent(scriptHelper.getScript().getScriptResource().getPath());
+                // check if parent resides on search path
+                for (String sp : resolver.getSearchPath()) {
+                    if (parentPath.startsWith(sp)) {
+                        parentPath = parentPath.substring(sp.length());
+                        break;
+                    }
+                }
+                scriptPath = parentPath + "/" + script;
+
+            } else {
+
+                scriptPath = this.script;
+            }
+            servlet = servletResolver.resolveServlet(resolver, scriptPath);
+
+            if (servlet != null) {
+                servletName = RequestUtil.getServletName(servlet);
+                tracker.log("Including script {0} (ignoring component hierarchy): {1}", script,
servletName);
+            }
+        }
+
+        if (servlet == null) {
+            throw new JspException("Could not find script " + script);
+        }
+
+        try {
+            if (flush && !(pageContext.getOut() instanceof BodyContent)) {
+                // might throw an IOException of course
+                pageContext.getOut().flush();
+            }
+
+            // wrap the response to get the correct output order
+            SlingHttpServletResponse response = new JspSlingHttpServletResponseWrapper(pageContext);
+
+            tracker.startTimer(servletName);
+
+            servlet.service(pageContext.getRequest(), response);
+
+            tracker.logTimer(servletName);
+
+            return EVAL_PAGE;
+
+        } catch (Exception e) {
+
+            log.error("Error while executing script " + script, e);
+            throw new JspException("Error while executing script " + script, e);
+
+        }
+    }
+    
+    @Override
+    public void setPageContext(PageContext pageContext) {
+        super.setPageContext(pageContext);
+        script = null;
+        flush = false;
+        ignoreComponentHierarchy = false;
+    }
+
+    /**
+     * Sets the script attribute
+     * @param script attribute value
+     */
+    public void setScript(String script) {
+        this.script = script;
+    }
+
+    /**
+     * Sets the flush attribute
+     * @param flush attribute value
+     */
+    public void setFlush(boolean flush) {
+        this.flush = flush;
+    }
+
+    /**
+     * Set the ignore component hierarchy attribute
+     * @param ignoreComponentHierarchy attribute value
+     */
+    public void setIgnoreComponentHierarchy(boolean ignoreComponentHierarchy) {
+        this.ignoreComponentHierarchy = ignoreComponentHierarchy;
+    }
+
+}

Propchange: sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/CallTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/CallTag.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib12.tld
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib12.tld?rev=1398589&view=auto
==============================================================================
--- sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib12.tld (added)
+++ sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib12.tld Tue
Oct 16 00:54:42 2012
@@ -0,0 +1,341 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+    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.
+-->
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+    version="2.0">
+
+    <description>A supporting tab library for Apache Sling</description>
+    <tlib-version>1.2</tlib-version>
+    <short-name>sling</short-name>
+    <uri>http://sling.apache.org/taglibs/sling/1.2</uri>
+
+    <tag>
+        <description>
+            Execute a script.
+        </description>
+        <name>call</name>
+        <tag-class>
+            org.apache.sling.scripting.jsp.taglib.CallTag
+        </tag-class>
+        <body-content>empty</body-content>
+        <attribute>
+            <description>
+                Whether to flush the output before including the target
+            </description>
+            <name>flush</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+            <type>boolean</type>
+        </attribute>
+        <attribute>
+            <description>
+                The script to include.
+            </description>
+            <name>script</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                Controls if the component hierarchy should be ignored for script
+                resolution. If true, only the search paths are respected.
+            </description>
+            <name>ignoreComponentHierarchy</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <description>
+            Includes a resource rendering into the current page
+        </description>
+        <name>include</name>
+        <tag-class>
+            org.apache.sling.scripting.jsp.taglib.IncludeTagHandler
+        </tag-class>
+        <body-content>empty</body-content>
+        <attribute>
+            <description>
+                Whether to flush the output before including the target
+            </description>
+            <name>flush</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+            <type>boolean</type>
+        </attribute>
+        <attribute>
+            <description>
+                The resource object to include in the current request
+                processing. Either resource or path must be specified. If
+                both are specified, the resource takes precedences.
+            </description>
+            <name>resource</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+            <type>org.apache.sling.api.resource.Resource</type>
+        </attribute>
+        <attribute>
+            <description>
+                The path to the resource object to include in the current
+                request processing. If this path is relative it is
+                appended to the path of the current resource whose
+                script is including the given resource. Either resource
+                or path must be specified. If both are specified, the
+                resource takes precedences.
+            </description>
+            <name>path</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                The resource type of a resource to include. If the resource
+                to be included is specified with the path attribute,
+                which cannot be resolved to a resource, the tag may
+                create a synthetic resource object out of the path and
+                this resource type. If the resource type is set the path
+                must be the exact path to a resource object. That is,
+                adding parameters, selectors and extensions to the path
+                is not supported if the resource type is set.
+            </description>
+            <name>resourceType</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                When dispatching, replace selectors by the value
+                provided by this option.
+            </description>
+            <name>replaceSelectors</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                When dispatching, add the value provided by this option to the selectors.
+            </description>
+            <name>addSelectors</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                When dispatching, replace the suffix by the value
+                provided by this option.
+            </description>
+            <name>replaceSuffix</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <description>
+            Forwards a request to a resource rendering the current page
+        </description>
+        <name>forward</name>
+        <tag-class>
+            org.apache.sling.scripting.jsp.taglib.ForwardTagHandler
+        </tag-class>
+        <body-content>empty</body-content>
+        <attribute>
+            <description>
+                The resource object to forward the request to. Either
+                resource or path must be specified. If both are
+                specified, the resource takes precedences.
+            </description>
+            <name>resource</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+            <type>org.apache.sling.api.resource.Resource</type>
+        </attribute>
+        <attribute>
+            <description>
+                The path to the resource object to forward the request
+                to. If this path is relative it is appended to the path
+                of the current resource whose script is forwarding the
+                given resource. Either resource or path must be specified.
+                If both are specified, the resource takes precedences.
+            </description>
+            <name>path</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                The resource type of a resource to forward. If the resource
+                to be forwarded is specified with the path attribute,
+                which cannot be resolved to a resource, the tag may
+                create a synthetic resource object out of the path and
+                this resource type. If the resource type is set the path
+                must be the exact path to a resource object. That is,
+                adding parameters, selectors and extensions to the path
+                is not supported if the resource type is set.
+            </description>
+            <name>resourceType</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                When dispatching, replace selectors by the value
+                provided by this option.
+            </description>
+            <name>replaceSelectors</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                When dispatching, add the value provided by this option to the selectors.
+            </description>
+            <name>addSelectors</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                When dispatching, replace the suffix by the value
+                provided by this option.
+            </description>
+            <name>replaceSuffix</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <description>
+            Defines regularly used scripting variables
+        </description>
+        <name>defineObjects</name>
+        <tag-class>
+            org.apache.sling.scripting.jsp.taglib.DefineObjectsTag
+        </tag-class>
+        <tei-class>
+            org.apache.sling.scripting.jsp.taglib.DefineObjectsTEI
+        </tei-class>
+        <body-content>empty</body-content>
+        <attribute>
+            <name>requestName</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>responseName</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>resourceName</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>nodeName</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>logName</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>resourceResolverName</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>slingName</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+    </tag>
+
+    <tag>
+        <description>
+            Evaluates a script invocation and includes the result
+            in the current page.
+        </description>
+        <name>eval</name>
+        <tag-class>
+            org.apache.sling.scripting.jsp.taglib.EvalTagHandler
+        </tag-class>
+        <body-content>empty</body-content>
+        <attribute>
+            <description>
+                Whether to flush the output before including the target
+            </description>
+            <name>flush</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+            <type>boolean</type>
+        </attribute>
+        <attribute>
+            <description>
+                The path to the script object to include in the current
+                request processing. By default, the current resource
+                is used for script resolving. This behaviour can 
+                be changed by specifying either resource, resourceType
+                or ignoreResourceTypeHierarchy.
+            </description>
+            <name>script</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                The resource object to include in the current request
+                processing. This attribute is optional. If it is
+                specified, resourceType should not be used. If both
+                are used, resource takes precedence.
+            </description>
+            <name>resource</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+            <type>org.apache.sling.api.resource.Resource</type>
+        </attribute>
+        <attribute>
+            <description>
+                The resource type of a resource to include. This
+                attribute is optional. If it is specified, resource
+                should not be used. If bot are used, resource
+                takes precedence.
+            </description>
+            <name>resourceType</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <description>
+                Prevents using the resource type hierarchy for searching
+                a script.
+            </description>
+            <name>ignoreResourceTypeHierarchy</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+            <type>boolean</type>
+        </attribute>
+    </tag>
+</taglib>

Propchange: sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib12.tld
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=1398589&r1=1398588&r2=1398589&view=diff
==============================================================================
--- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original)
+++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Tue Oct 16 00:54:42 2012
@@ -190,7 +190,7 @@
         <bundle>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.jsp.taglib</artifactId>
-            <version>2.1.6</version>
+            <version>2.1.7-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.codehaus.groovy</groupId>

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java?rev=1398589&r1=1398588&r2=1398589&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
Tue Oct 16 00:54:42 2012
@@ -38,7 +38,8 @@ import org.apache.sling.servlets.post.Sl
     private String nodeUrlD;
     private String nodeUrlE;
     private String nodeUrlF;
-    private String scriptPath;
+    private String nodeUrlG;
+    private String nodeUrlH;
     private String forcedResourceType;
     private Set<String> toDelete = new HashSet<String>();
 
@@ -85,6 +86,12 @@ import org.apache.sling.servlets.post.Sl
         props.put("pathToInclude", pathToInclude);
         nodeUrlD = testClient.createNode(url, props);
 
+        // Node G is used for the basic "call" test
+        props.remove("forceResourceType");
+        props.remove("pathToInclude");
+        props.put("testCallScript", "called-test.jsp");
+        nodeUrlG = testClient.createNode(url, props);
+
         // Script for forced resource type
         scriptPath = "/apps/" + forcedResourceType;
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
@@ -94,13 +101,27 @@ import org.apache.sling.servlets.post.Sl
         scriptPath = "/apps/nt/unstructured";
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
         toDelete.add(uploadTestScript(scriptPath,"include-test.jsp","html.jsp"));
+        toDelete.add(uploadTestScript(scriptPath,"called-test.jsp","called-test.jsp"));
+
+        // Node H is used for "call" test where the called script is inherited from the supertype
+        String nodeHResourceType = getClass().getSimpleName() + "/" + System.currentTimeMillis();
+        String nodeHSuperResourceType = getClass().getSimpleName() + "/super" + System.currentTimeMillis();
+        props.put("sling:resourceType", nodeHResourceType);
+        props.put("sling:resourceSuperType", nodeHSuperResourceType);
+        nodeUrlH = testClient.createNode(url, props);
+        scriptPath = "/apps/" + nodeHResourceType;
+        testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
+        toDelete.add(uploadTestScript(scriptPath,"calling-test.jsp","html.jsp"));
+        scriptPath = "/apps/" + nodeHSuperResourceType;
+        testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
+        toDelete.add(uploadTestScript(scriptPath,"called-test.jsp","called-test.jsp"));
     }
 
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
         for(String script : toDelete) {
-            testClient.delete(script);
+           testClient.delete(script);
         }
     }
 
@@ -167,4 +188,19 @@ import org.apache.sling.servlets.post.Sl
         assertTrue("Text of node A is included (" + content + ")",content.contains(testTextA));
         assertTrue("Resource type has been forced (" + content + ")",content.contains("Forced
resource type:" + forcedResourceType));
     }
+
+    public void testCall() throws IOException {
+        final String content = getContent(nodeUrlG + ".html", CONTENT_TYPE_HTML);
+        assertTrue("Content includes JSP marker",content.contains("JSP template"));
+        assertTrue("Content contains formatted test text",content.contains("<p class=\"main\">"
+ testTextB + "</p>"));
+        assertTrue("Call has been used",content.contains("<p>Calling"));
+        assertTrue("Call has been made",content.contains("called"));
+    }
+
+    public void testCallToSupertype() throws IOException {
+        System.out.println(nodeUrlH);
+        final String content = getContent(nodeUrlH + ".html", CONTENT_TYPE_HTML);
+        assertTrue("Content includes JSP marker",content.contains("JSP template"));
+        assertTrue("Call has been made",content.contains("called"));
+    }
 }

Added: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/called-test.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/called-test.jsp?rev=1398589&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/called-test.jsp
(added)
+++ sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/called-test.jsp
Tue Oct 16 00:54:42 2012
@@ -0,0 +1,19 @@
+<%--
+/*
+ * 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.
+--%><%@page session="false"%>called
\ No newline at end of file

Propchange: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/called-test.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/calling-test.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/calling-test.jsp?rev=1398589&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/calling-test.jsp
(added)
+++ sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/calling-test.jsp
Tue Oct 16 00:54:42 2012
@@ -0,0 +1,29 @@
+<%--
+/*
+ * 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.
+ */
+--%><%@page session="false"%><%
+%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2"%><%
+%><sling:defineObjects/><%
+// used by IncludeTest
+%><html>
+<body>
+		<h1>JSP template</h1>
+	 	<sling:call script="called-test.jsp"/>
+</body>
+</html>

Propchange: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/calling-test.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp?rev=1398589&r1=1398588&r2=1398589&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp
Tue Oct 16 00:54:42 2012
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.
 --%><%@page session="false"%><%
-%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%><%
+%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2"%><%
 %><sling:defineObjects/><%
  
 // used by IncludeTest
@@ -41,6 +41,7 @@ String pathToInclude = getProperty(curre
 String forceResourceType = getProperty(currentNode, "forceResourceType");
 String testInfiniteLoop = getProperty(currentNode, "testInfiniteLoop");
 String testMaxCalls = getProperty(currentNode, "testMaxCalls");
+String testCallScript = getProperty(currentNode, "testCallScript");
 
 %><html>
 	<body>
@@ -99,5 +100,15 @@ String testMaxCalls = getProperty(curren
 			    }
 			}
 		%>
+
+		<h2>Test 5</h2>
+		<%
+			if (testCallScript != null) {
+		%>
+				<p>Calling <%= testCallScript %></p>
+				<sling:call script="<%= testCallScript %>" />
+		<%
+			}
+		%>
 	</body>
 </html>



Mime
View raw message