sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r652803 - in /incubator/sling/trunk: launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/ launchpad/webapp/src/test/java/...
Date Fri, 02 May 2008 16:29:57 GMT
Author: cziegeler
Date: Fri May  2 09:29:56 2008
New Revision: 652803

URL: http://svn.apache.org/viewvc?rev=652803&view=rev
Log:
SLING-367: sling:post: prefix is renamed to just ':'.

Modified:
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/GeneratedNodeNameTest.java
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/PostRedirectTest.java
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletDeleteTest.java
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletMoveTest.java
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOrderTest.java
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingDefaultValuesTest.java
    incubator/sling/trunk/sling/servlets-post/src/main/java/org/apache/sling/servlets/post/impl/SlingPostProcessor.java
    incubator/sling/trunk/sling/servlets-post/src/main/resources/system/sling.js

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/GeneratedNodeNameTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/GeneratedNodeNameTest.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/GeneratedNodeNameTest.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/GeneratedNodeNameTest.java
Fri May  2 09:29:56 2008
@@ -39,7 +39,7 @@
 
     public void testSlingPostNodeNameParam() throws IOException {
         final Map<String,String> props = new HashMap<String,String>();
-        props.put("sling:post:name", "MyNodeName");
+        props.put(":name", "MyNodeName");
         final String location = testClient.createNode(postUrl, props);
         final String expect = "MyNodeName";
         assertTrue("Location " + location + " ends with " + expect,location.endsWith(expect));
@@ -47,7 +47,7 @@
 
     public void testSlingPostNodeNameHintParam() throws IOException {
         final Map<String,String> props = new HashMap<String,String>();
-        props.put("sling:post:nameHint", "AnotherNodeName");
+        props.put(":nameHint", "AnotherNodeName");
         final String location = testClient.createNode(postUrl, props);
         final String expect = "AnotherNodeName".toLowerCase();
         assertTrue("Location " + location + " ends with " + expect,location.endsWith(expect));

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/PostRedirectTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/PostRedirectTest.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/PostRedirectTest.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/PostRedirectTest.java
Fri May  2 09:29:56 2008
@@ -32,7 +32,7 @@
 
     public void testForcedRedirect() throws IOException {
         final Map<String, String> params = new HashMap<String, String>();
-        params.put("sling:post:redirect", "http://forced/");
+        params.put(":redirect", "http://forced/");
         final Map<String, String> headers = new HashMap<String, String>();
         headers.put("Referer", "http://referer/");
 
@@ -45,7 +45,7 @@
 
     public void testDefaultRedirect() throws IOException {
         final Map<String, String> params = new HashMap<String, String>();
-        params.put("sling:post:redirect", null);
+        params.put(":redirect", null);
         final String location = testClient.createNode(postUrl, null, null,
             false);
         assertTrue("With no headers or parameters, redirect (" + location
@@ -55,7 +55,7 @@
 
     public void testMagicStarRedirect() throws IOException {
         final Map<String, String> params = new HashMap<String, String>();
-        params.put("sling:post:redirect", "*");
+        params.put(":redirect", "*");
         final Map<String, String> headers = new HashMap<String, String>();
         headers.put("Referer", "http://referer/");
         final String location = testClient.createNode(postUrl, params, headers,
@@ -68,7 +68,7 @@
     public void testMagicStarRedirectPrefix() throws IOException {
         String prefix = "xyz/";
         final Map<String, String> params = new HashMap<String, String>();
-        params.put("sling:post:redirect", prefix + "*");
+        params.put(":redirect", prefix + "*");
         final Map<String, String> headers = new HashMap<String, String>();
         headers.put("Referer", "http://referer/");
         final String location = testClient.createNode(postUrl, params, headers,
@@ -80,7 +80,7 @@
     public void testMagicStarRedirectSuffix() throws IOException {
         String suffix = "/xyz.html";
         final Map<String, String> params = new HashMap<String, String>();
-        params.put("sling:post:redirect", "*" + suffix);
+        params.put(":redirect", "*" + suffix);
         final Map<String, String> headers = new HashMap<String, String>();
         headers.put("Referer", "http://referer/");
         final String location = testClient.createNode(postUrl, params, headers,
@@ -93,7 +93,7 @@
         String prefix = "xyz/";
         String suffix = "/xyz.html";
         final Map<String, String> params = new HashMap<String, String>();
-        params.put("sling:post:redirect", prefix + "*" + suffix);
+        params.put(":redirect", prefix + "*" + suffix);
         final Map<String, String> headers = new HashMap<String, String>();
         headers.put("Referer", "http://referer/");
         final String location = testClient.createNode(postUrl, params, headers,

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/UslingIntegrationTestClient.java
Fri May  2 09:29:56 2008
@@ -116,8 +116,8 @@
         Map<String, String> nodeProperties = new HashMap<String, String>();
 
         // add sling specific properties
-        nodeProperties.put("sling:post:redirect", url);
-        nodeProperties.put("sling:post:displayExtension", "");
+        nodeProperties.put(":redirect", url);
+        nodeProperties.put(":displayExtension", "");
 
         // take over any client provided properties
         if (clientNodeProperties != null) {

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCopyTest.java
Fri May  2 09:29:56 2008
@@ -39,8 +39,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:copySrc", testPath + "/src");
-        props.put("sling:post:copyDest", testPath + "/dest");
+        props.put(":copySrc", testPath + "/src");
+        props.put(":copyDest", testPath + "/dest");
         testClient.createNode(HTTP_BASE_URL + testPath, props);
         String content = getContent(HTTP_BASE_URL + testPath + "/dest.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -53,8 +53,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:copySrc", "src");
-        props.put("sling:post:copyDest", "dest");
+        props.put(":copySrc", "src");
+        props.put(":copyDest", "dest");
         testClient.createNode(HTTP_BASE_URL + testPath, props);
         String content = getContent(HTTP_BASE_URL + testPath + "/dest.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -67,8 +67,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:copySrc", testPath + "/src");
-        props.put("sling:post:copyDest", "new");
+        props.put(":copySrc", testPath + "/src");
+        props.put(":copyDest", "new");
         String newNode = testClient.createNode(HTTP_BASE_URL + testPath + "/*", props);
         String content = getContent(newNode + "/new.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -81,8 +81,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:copySrc", testPath + "/src");
-        props.put("sling:post:copyDest", "*");
+        props.put(":copySrc", testPath + "/src");
+        props.put(":copyDest", "*");
         String newNode = testClient.createNode(HTTP_BASE_URL + testPath + "/*", props);
         String content = getContent(newNode + ".json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -99,8 +99,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/dest", props);
 
         props.clear();
-        props.put("sling:post:copySrc", testPath + "/src");
-        props.put("sling:post:copyDest", testPath + "/dest");
+        props.put(":copySrc", testPath + "/src");
+        props.put(":copyDest", testPath + "/dest");
         try {
             testClient.createNode(HTTP_BASE_URL + testPath, props);
         } catch (IOException ioe) {
@@ -126,9 +126,9 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/dest", props);
 
         props.clear();
-        props.put("sling:post:copySrc", testPath + "/src");
-        props.put("sling:post:copyDest", testPath + "/dest");
-        props.put("sling:post:copyFlags", "replace");  // replace dest
+        props.put(":copySrc", testPath + "/src");
+        props.put(":copyDest", testPath + "/dest");
+        props.put(":copyFlags", "replace");  // replace dest
         testClient.createNode(HTTP_BASE_URL + testPath, props);
         String content = getContent(HTTP_BASE_URL + testPath + "/dest.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -141,8 +141,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:copySrc", testPath + "/src");
-        props.put("sling:post:copyDest", "deep/new");
+        props.put(":copySrc", testPath + "/src");
+        props.put(":copyDest", "deep/new");
         String newNode = testClient.createNode(HTTP_BASE_URL + testPath + "/*", props);
         String content = getContent(newNode + "/deep/new.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -155,8 +155,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:copySrc", testPath + "/src");
-        props.put("sling:post:copyDest", "/some/not/existing/structure");
+        props.put(":copySrc", testPath + "/src");
+        props.put(":copyDest", "/some/not/existing/structure");
         try {
             testClient.createNode(HTTP_BASE_URL + testPath + "/*", props);
             // not quite correct. should check status response

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletCreateTest.java
Fri May  2 09:29:56 2008
@@ -127,7 +127,7 @@
         props.put("STUFF_a","123");
         props.put("STUFF_b","456");
         props.put("c","not saved");
-        props.put("sling:post:saveParamPrefix","STUFF_");
+        props.put(":saveParamPrefix","STUFF_");
         final String createdNodeUrl = testClient.createNode(postUrl + SlingPostServlet.DEFAULT_CREATE_SUFFIX,
props,null,false);
         final String content = getContent(createdNodeUrl + ".json", CONTENT_TYPE_JSON);
         assertJavascript("123456", content, "out.println(data.a + data.b)");
@@ -141,7 +141,7 @@
         props.put("++a","123");
         props.put("++b","456");
         props.put("c","not saved");
-        props.put("sling:post:saveParamPrefix","++");
+        props.put(":saveParamPrefix","++");
         final String createdNodeUrl = testClient.createNode(postUrl + SlingPostServlet.DEFAULT_CREATE_SUFFIX,
props,null,false);
         final String content = getContent(createdNodeUrl + ".json", CONTENT_TYPE_JSON);
         assertJavascript("123456", content, "out.println(data.a + data.b)");

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletDeleteTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletDeleteTest.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletDeleteTest.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletDeleteTest.java
Fri May  2 09:29:56 2008
@@ -54,7 +54,7 @@
 
         // delete one and check
         final List <NameValuePair> params = new LinkedList<NameValuePair> ();
-        final String deleteCmd = "sling:post:delete";
+        final String deleteCmd = ":delete";
         params.add(new NameValuePair(deleteCmd,urlToNodePath(urlA)));
         assertPostStatus(postUrl,HttpServletResponse.SC_OK,params,"Delete must return expected
status (3)");
         assertHttpStatus(urlA, HttpServletResponse.SC_NOT_FOUND, "A must be deleted (1)");

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletMoveTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletMoveTest.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletMoveTest.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletMoveTest.java
Fri May  2 09:29:56 2008
@@ -39,8 +39,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:moveSrc", testPath + "/src");
-        props.put("sling:post:moveDest", testPath + "/dest");
+        props.put(":moveSrc", testPath + "/src");
+        props.put(":moveDest", testPath + "/dest");
         testClient.createNode(HTTP_BASE_URL + testPath, props);
         String content = getContent(HTTP_BASE_URL + testPath + "/dest.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -53,8 +53,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:moveSrc", "src");
-        props.put("sling:post:moveDest", "dest");
+        props.put(":moveSrc", "src");
+        props.put(":moveDest", "dest");
         testClient.createNode(HTTP_BASE_URL + testPath, props);
         String content = getContent(HTTP_BASE_URL + testPath + "/dest.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -67,8 +67,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:moveSrc", testPath + "/src");
-        props.put("sling:post:moveDest", "new");
+        props.put(":moveSrc", testPath + "/src");
+        props.put(":moveDest", "new");
         String newNode = testClient.createNode(HTTP_BASE_URL + testPath + "/*", props);
         String content = getContent(newNode + "/new.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -85,8 +85,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/dest", props);
 
         props.clear();
-        props.put("sling:post:moveSrc", testPath + "/src");
-        props.put("sling:post:moveDest", testPath + "/dest");
+        props.put(":moveSrc", testPath + "/src");
+        props.put(":moveDest", testPath + "/dest");
         try {
             testClient.createNode(HTTP_BASE_URL + testPath, props);
         } catch (IOException ioe) {
@@ -112,9 +112,9 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/dest", props);
 
         props.clear();
-        props.put("sling:post:moveSrc", testPath + "/src");
-        props.put("sling:post:moveDest", testPath + "/dest");
-        props.put("sling:post:moveFlags", "replace");  // replace dest
+        props.put(":moveSrc", testPath + "/src");
+        props.put(":moveDest", testPath + "/dest");
+        props.put(":moveFlags", "replace");  // replace dest
         testClient.createNode(HTTP_BASE_URL + testPath, props);
         String content = getContent(HTTP_BASE_URL + testPath + "/dest.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -127,8 +127,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:moveSrc", testPath + "/src");
-        props.put("sling:post:moveDest", "deep/new");
+        props.put(":moveSrc", testPath + "/src");
+        props.put(":moveDest", "deep/new");
         String newNode = testClient.createNode(HTTP_BASE_URL + testPath + "/*", props);
         String content = getContent(newNode + "/deep/new.json", CONTENT_TYPE_JSON);
         assertJavascript("Hello", content, "out.println(data.text)");
@@ -141,8 +141,8 @@
         testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
 
         props.clear();
-        props.put("sling:post:moveSrc", testPath + "/src");
-        props.put("sling:post:moveDest", "/some/not/existing/structure");
+        props.put(":moveSrc", testPath + "/src");
+        props.put(":moveDest", "/some/not/existing/structure");
         try {
             testClient.createNode(HTTP_BASE_URL + testPath + "/*", props);
             // not quite correct. should check status response

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOrderTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOrderTest.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOrderTest.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOrderTest.java
Fri May  2 09:29:56 2008
@@ -56,112 +56,112 @@
 
     /**
      * Create nodes and check if they are in correct order after a
-     * sling:post:order="first" request
+     * :order="first" request
      */
     public void testOrderFirst() throws IOException {
         final String postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
         createNodes(postUrl, DEFAULT_ORDER);
 
         final Map <String, String> props = new HashMap <String, String> ();
-        props.put("sling:post:order","first");
+        props.put(":order","first");
         testClient.createNode(postUrl + "/c", props);
         verifyOrder(postUrl, new String[]{"c", "a", "b", "d"});
     }
 
     /**
      * Create nodes and check if they are in correct order after a
-     * sling:post:order="last" request
+     * :order="last" request
      */
     public void testOrderLast() throws IOException {
         final String postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
         createNodes(postUrl, DEFAULT_ORDER);
 
         final Map <String, String> props = new HashMap <String, String> ();
-        props.put("sling:post:order","last");
+        props.put(":order","last");
         testClient.createNode(postUrl + "/c", props);
         verifyOrder(postUrl, new String[]{"a", "b", "d", "c"});
     }
 
     /**
      * Create nodes and check if they are in correct order after a
-     * sling:post:order="before" request
+     * :order="before" request
      */
     public void testOrderBefore() throws IOException {
         final String postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
         createNodes(postUrl, DEFAULT_ORDER);
 
         final Map <String, String> props = new HashMap <String, String> ();
-        props.put("sling:post:order","before b");
+        props.put(":order","before b");
         testClient.createNode(postUrl + "/c", props);
         verifyOrder(postUrl, new String[]{"a", "c", "b", "d"});
     }
 
     /**
      * Create nodes and check if they are in correct order after a
-     * sling:post:order="after" request
+     * :order="after" request
      */
     public void testOrderAfter() throws IOException {
         final String postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
         createNodes(postUrl, DEFAULT_ORDER);
 
         final Map <String, String> props = new HashMap <String, String> ();
-        props.put("sling:post:order","after c");
+        props.put(":order","after c");
         testClient.createNode(postUrl + "/b", props);
         verifyOrder(postUrl, new String[]{"a", "c", "b", "d"});
     }
 
     /**
      * Create nodes and check if they are in correct order after a
-     * sling:post:order="N" request, where new position is greater than old one.
+     * :order="N" request, where new position is greater than old one.
      */
     public void testOrderIntToBack() throws IOException {
         final String postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
         createNodes(postUrl, DEFAULT_ORDER);
 
         final Map <String, String> props = new HashMap <String, String> ();
-        props.put("sling:post:order","2");
+        props.put(":order","2");
         testClient.createNode(postUrl + "/a", props);
         verifyOrder(postUrl, new String[]{"b", "c", "a", "d"});
     }
 
     /**
      * Create nodes and check if they are in correct order after a
-     * sling:post:order="N" request, where new position is less than old one.
+     * :order="N" request, where new position is less than old one.
      */
     public void testOrderIntToFront() throws IOException {
         final String postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
         createNodes(postUrl, DEFAULT_ORDER);
 
         final Map <String, String> props = new HashMap <String, String> ();
-        props.put("sling:post:order","1");
+        props.put(":order","1");
         testClient.createNode(postUrl + "/d", props);
         verifyOrder(postUrl, new String[]{"a", "d", "b", "c"});
     }
 
     /**
      * Create nodes and check if they are in correct order after a
-     * sling:post:order="0" request
+     * :order="0" request
      */
     public void testOrderIntZero() throws IOException {
         final String postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
         createNodes(postUrl, DEFAULT_ORDER);
 
         final Map <String, String> props = new HashMap <String, String> ();
-        props.put("sling:post:order","0");
+        props.put(":order","0");
         testClient.createNode(postUrl + "/d", props);
         verifyOrder(postUrl, new String[]{"d", "a", "b", "c"});
     }
 
     /**
      * Create nodes and check if they are in correct order after a
-     * sling:post:order="N" request, where new position is out of bounds
+     * :order="N" request, where new position is out of bounds
      */
     public void testOrderIntOOB() throws IOException {
         final String postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
         createNodes(postUrl, DEFAULT_ORDER);
 
         final Map <String, String> props = new HashMap <String, String> ();
-        props.put("sling:post:order","100");
+        props.put(":order","100");
         testClient.createNode(postUrl + "/a", props);
         verifyOrder(postUrl, new String[]{"b", "c", "d", "a"});
     }

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingDefaultValuesTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingDefaultValuesTest.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingDefaultValuesTest.java
(original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingDefaultValuesTest.java
Fri May  2 09:29:56 2008
@@ -77,7 +77,7 @@
     public void testWithIgnore() throws IOException {
         final Map <String, String> props = new HashMap <String, String> ();
         props.put("a","");
-        props.put("a@DefaultValue","sling:post:ignore");
+        props.put("a@DefaultValue",":ignore");
 
         final String createdNodeUrl = testClient.createNode(postUrl + SlingPostServlet.DEFAULT_CREATE_SUFFIX,
props);
         final String content = getContent(createdNodeUrl + ".json", CONTENT_TYPE_JSON);
@@ -96,7 +96,7 @@
 
         // now try to delete prop by sending empty string
         props.put("a","");
-        props.put("a@DefaultValue","sling:post:null");
+        props.put("a@DefaultValue",":null");
         testClient.createNode(createdNodeUrl, props);
         content = getContent(createdNodeUrl + ".json", CONTENT_TYPE_JSON);
 

Modified: incubator/sling/trunk/sling/servlets-post/src/main/java/org/apache/sling/servlets/post/impl/SlingPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-post/src/main/java/org/apache/sling/servlets/post/impl/SlingPostProcessor.java?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-post/src/main/java/org/apache/sling/servlets/post/impl/SlingPostProcessor.java
(original)
+++ incubator/sling/trunk/sling/servlets-post/src/main/java/org/apache/sling/servlets/post/impl/SlingPostProcessor.java
Fri May  2 09:29:56 2008
@@ -675,13 +675,37 @@
         if (path == null || !path.startsWith("/")) {
             throw new IllegalArgumentException("path must be an absolute path.");
         }
-        int from = 1;
-        Node node = session.getRootNode();
+        // get the starting node
+        String startingNodePath = path;
+        Node startingNode = null;
+        while ( startingNode == null ) {
+            if ( startingNodePath.equals("/") ) {
+                startingNode = session.getRootNode();
+            } else if ( session.itemExists(startingNodePath) ) {
+                startingNode = (Node)session.getItem(startingNodePath);
+            } else {
+                int pos = startingNodePath.lastIndexOf('/');
+                if (pos > 0 ) {
+                    startingNodePath = startingNodePath.substring(0, pos);
+                } else {
+                    startingNodePath = "/";
+                }
+            }
+        }
+        // is the searched node already existing?
+        if (startingNodePath.length() == path.length() ) {
+            return startingNode;
+        }
+        // create nodes
+        int from = (startingNodePath.length() == 1 ? 1 : startingNodePath.length() + 1);
+        Node node = startingNode;
         while (from > 0) {
             final int to = path.indexOf('/', from);
             final String name = to < 0
                     ? path.substring(from)
                     : path.substring(from, to);
+            // although the node should not exist (according to the first test above)
+            // we do a sanety check.
             if (node.hasNode(name)) {
                 node = node.getNode(name);
             } else {

Modified: incubator/sling/trunk/sling/servlets-post/src/main/resources/system/sling.js
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-post/src/main/resources/system/sling.js?rev=652803&r1=652802&r2=652803&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-post/src/main/resources/system/sling.js (original)
+++ incubator/sling/trunk/sling/servlets-post/src/main/resources/system/sling.js Fri May 
2 09:29:56 2008
@@ -177,7 +177,7 @@
 	Sling.removeContent = function(path) {
 		var httpcon = Sling.getXHR();
 		if (httpcon) {
-			var params = "sling:post:delete="+path;
+			var params = ":delete="+path;
 			httpcon.open('POST', Sling.baseurl + path, false);
 
 			// Send the proper header information along with the request



Mime
View raw message