On 7/30/10 5:40 AM, Audrey Colbrant wrote:
> Hi Bertrand,
> 
> Thanks for your answer.
> 
>>> If your other changes were persisted, a save() call must have happened
>>> somewhere.
> You've pointed out what I don't understand.
> 
> I have defined several handlers (extending SlingSafeMethodsServlet & 
> AbstractSlingPostOperation) in which I modify JCR content 
> (create/delete/modify nodes and properties of nodes but never manipulated a 
> file). I have never called save() in handlers (seems to be a mistake) and 
> changes were persisted. I agree with you, it means somewhere, save() is 
> called, but not in my code.
> 
> Here, inserting a file in a class extending SlingSafeMethodsServlet, I need 
> to explicitly call save().
A warning - SlingSafeMethodsServlet is specifically designed for
read-only operations. You should not be writing to the repository from
within a subclass of SlingSafeMethodsServlet. Use SlingAllMethodsServlet
and override doPut() or doPost().

Creating/deleting/modifying the repository inside
SlingSafeMethodsServlet will cause Roy Fielding to haunt your dreams.

Justin

> 
>  So two things:
>  - why modifications are persisted if I don't call save() in my other 
> handlers, while for manipulating a file I need to explicitly call this method?
>  - do you recommend me to call save() in the end of all my handlers?
> 
> Audrey
> 

Reply via email to