Hi Michael, > I think that the processing of POSTs, i.e. writing into the repository > should be scriptable just like the processing of GETs is. This means that > the MicrojaxPostServlet should not parse hard-coded parameters and do some > hard-coded stuff with them. It should invoke a script. That script should be > able to write, delete, modify, etc (e.g. by getting the request and the > repository as scriptable objects). I agree, there may be cases where you want to handle the POST on the server side. Mostly this is the case when you don't trust the user/client. Comments in a blog are the perfect example.
In some initial discussions we talked about the following scripting capabilities for example: html.esp -> would handle /mynode.html edit/html.esp -> would handle /mynode.edit.html POST.esp -> would handle/overwrite the POST PUT.esp -> would handle/overwrite the PUT > AFAIK there is still some filters to be implemented, but IMO that will not > cut it. I think that the core functionality of repository writing needs to > be open for the app developer (even if you think of Sling as a > "presentation" framework - my simple blogging app has already hit this > wall). We could still keep the mechanism right now for very simple cases or > as a fall-back. While i agree that we can never cover 100% of the usecases I think we should aim to cover the 95% simple usecases without modifying the POST. I think extending the standard ootb behaviour as we find good broadly supported usecase basis makes a lot of sense. > (*) In order to not get too esoteric, here's some use cases that bugged me > (I am aware that there are workarounds for these): > My example app is a blogging application and I would like blog readers to be > able to leave comments. The problems are: > - the comments shall have a date. Currently, I need to set the date in the > browser and pass it along as a request parameter. What I would really like > is to set this date on the server, i.e. add a custom property before the > node gets written > (I am aware that I could use Repository Observers to get this done but do > not I want to write Java code for this) I think this is a very common usecase. I thought about that numerous times and I am even considering whether we should bolt that right into the repository, since for example a lot of databases support a timestamp on creation or modification. Of course in the short term I think this is a very common usecase and we could initialize all date properties in microjax with "current date". > - the comments shall be checked for Spam before they are written. > Especially, comments that contain links shall be get a special property > "suspicious" hmm... good point... i don't really have a good answer for that one, seems like this would be a good candiate or the POST.esp extension? > - I would like to moderate or delete comments in a batch, i.e. modify > multiple nodes in one request You should be able to do that already, right? Using (absolute) paths you should be able to modify any node in the repository. regards, david
