UjaxPostServlet should care to find an appropriate parent location for new nodes
--------------------------------------------------------------------------------

                 Key: SLING-233
                 URL: https://issues.apache.org/jira/browse/SLING-233
             Project: Sling
          Issue Type: Improvement
          Components: Launchpad
            Reporter: Felix Meschberger
            Assignee: Felix Meschberger
             Fix For: 2.0.0


When the UjaxPostServlet is called with an URL not resolving to an existing 
resource, it just takes the missing resource path as the path of the node to 
handle.

This may be a problem in case the ResourceResolver applies a mapping, such as:

       /* ==> /content/*   - try every path below /content/
       /* ==> /*      - try every path unmodified

The intent of this is to first locate resources below the /content/ node and 
only then unmodified. This way, the primary web site content may be stored 
below /content but still be accessed as if it would be located just below root.

Consider a POST request to /home/intro where the /home page does not exist 
(yet). In this case currently, the /home/intro node would be created as 
requested. If the /home page would be located at /content/home, the new node 
would be created as /content/home/intro.

To work around this problem, I suggest to modify the servlet, such that in the 
case of a missing resource such as /home/intro or /home/* the request path is 
walked up until a resource can be resolved. In the example POST to /home/intro 
with a missing /content/home resource, the post servlet would go up to "/" 
which resolves to "/content" (assuming /content exists of course) and thus 
would create the new node under /content/home automatically also creating the 
intermediate /content/home node.

To be able to still create nodes at the exact path, I propose the introduction 
of a control parameter ujax:parentMatch:

      ujax:parentMatch == "exact"  --> use the request path as node path as is 
without resolving a parent
      ujax:parentMatch == "resolve"  --> resolve a parent node and have 
intermediate nodes created accordingly

The default value if the ujax:parentMatch parameter is missing is "resolve".

WDYT ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to