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

svn commit: r641346 - in /incubator/sling/trunk: launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletCreateTest.java sling/ujax/src/main/java/org/apache/sling/ujax/impl/UjaxPostProcessor.java

Author: bdelacretaz
Date: Wed Mar 26 08:11:15 2008
New Revision: 641346

URL: http://svn.apache.org/viewvc?rev=641346&view=rev
Log:
SLING-343 - POST to something/*.html did not work

Modified:
    incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletCreateTest.java
    incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/impl/UjaxPostProcessor.java

Modified: incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletCreateTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletCreateTest.java?rev=641346&r1=641345&r2=641346&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletCreateTest.java (original)
+++ incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletCreateTest.java Wed Mar 26 08:11:15 2008
@@ -51,6 +51,16 @@
                 location.contains(postUrl + "/"));
     }
     
+    public void testCreateNodeWithExtension() throws IOException {
+        final String location = testClient.createNode(postUrl + UjaxPostServlet.DEFAULT_CREATE_SUFFIX + ".html", null);
+        assertHttpStatus(location, HttpServletResponse.SC_OK,
+                "POST must redirect to created resource (" + location + ")");
+        assertTrue("Node (" + location + ") must have generated name",
+                !location.endsWith("/*"));
+        assertTrue("Node (" + location + ") must created be under POST URL (" + postUrl + ")",
+                location.contains(postUrl + "/"));
+    }
+    
     public void testCreateNodeAtSpecificUrl() throws IOException {
         final String specifiedLocation = postUrl + "/specified-location";
         final String location = testClient.createNode(specifiedLocation, null);

Modified: incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/impl/UjaxPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/impl/UjaxPostProcessor.java?rev=641346&r1=641345&r2=641346&view=diff
==============================================================================
--- incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/impl/UjaxPostProcessor.java (original)
+++ incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/impl/UjaxPostProcessor.java Wed Mar 26 08:11:15 2008
@@ -146,9 +146,10 @@
             int dotPos = suffix.indexOf('.');
             if (dotPos > 0) {
                 suffix = suffix.substring(0, dotPos);
+            }
 
-            // otherwise check whether it is a create request (trailing /*)
-            } else if (suffix.endsWith(UjaxPostServlet.DEFAULT_CREATE_SUFFIX)) {
+            // and check whether it is a create request (trailing /*)
+            if (suffix.endsWith(UjaxPostServlet.DEFAULT_CREATE_SUFFIX)) {
                 suffix = suffix.substring(0, suffix.length()
                     - UjaxPostServlet.DEFAULT_CREATE_SUFFIX.length());
                 htmlResponse.setCreateRequest(true);