> On Fri, Jan 21, 2011 at 1:04 PM, Vidar Ramdal <[email protected]> wrote:
>> On Fri, Jan 21, 2011 at 12:58 PM, Markus Joschko
>> <[email protected]> wrote:
>>> Hi,
>>> I face some difficulties in realizing the following case:
>>>
>>> I have a node to which I want to add children. The problem is, that
>>> (depending on the content of the to be created node) it is not added
>>> to the node directly but a folder is created to which the node is
>>> added. Like that
>>>
>>> + parent
>>>     + folderA (dynamically created)
>>>         - childABC
>>>     + folderB (dynamically created)
>>>         -childBAC
>>>
>>> Because the folders might not be available, I post to parent/* and
>>> registered a postprocessor to create the folder and move the just
>>> created child to the corresponding folder.
>>> That works fine. However the redirect url is still pointing to the
>>> previous location (parent/childABC) instead of
>>> parent/folderA/childABC.
>>> And I can't find a way to modify the location of the response within
>>> the postprocessor.
>>>
>>> So I wonder whether I am on the right track or should choose a
>>> different approach. Alternatively I could create my own postoperation
>>> but that seems to be cumbersome as extending from ModifyOperation
>>> isn't easy because of the dependencies in the constructor and
>>> AbstractCreateOperation is package private. So I would basically need
>>> to copy code directly.
>>>
>>> Any thoughts on this?
>>
>> If you can modify the client's behaviour, you can add a :redirect
>> field to the POST request.
>> :redirect=parent/folderA/childABC
>>
>> See 
>> http://sling.apache.org/site/manipulating-content-the-slingpostservlet.html#ManipulatingContent-TheSlingPostServlet-%257B%257B%253Aredirect%257D%257D

On Fri, Jan 21, 2011 at 1:13 PM, Markus Joschko
<[email protected]> wrote:
> The problem is, that I don't know the folder name on the client
> already.  To stay in the example: folderA is not known to the client
> before.
> I need the posted node information to determine the folder name.

I see. How about:
- In your SlingPostProcessor, be sure that you register the nodes you
are adding in the modifications list (which is a parameter to
SlingPostProcessor.process(). This list is returned in the
HtmlResponse of SlingPostServlet.
- The client examines the returned HTML (or JSON) to find the path of
the created node, and redirects

-- 
Vidar S. Ramdal <[email protected]> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00
Quando omni flunkus moritatus!

Reply via email to