Hi,

On Nov 14, 2007 4:16 AM, Michael Marth <[EMAIL PROTECTED]> wrote:

> ...I think that the processing of POSTs, i.e. writing into the repository
> should be scriptable just like the processing of GETs is. ...

As others said, this is already the case, using a POST.js script for example.

But that completely replaces the default servlet behaviour, I agree
that it might be useful to expose this behaviour (creating nodes,
copying request parameters etc.) to user scripts. Maybe make the
default servlet available in the SlingRequest, or some of its methods
to help with that.

But there's another interesting option, let's look at your use cases:

> ...- 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 was actually thinking about making JCR observers scriptable as well.

We could have a "magic" repository location for scripts that would be
automatically bound to repository events, based on the touched node's
resource type.

For example, a script named

  /sling/events/nt/file/event.js

would be called for any events on nt:file nodes, or

  /sling/events/myblog/comment/node_added.js

would be called when a node is added with slingResourceType=myblog/comment

How does that sound? I think that would be a cool way of exposing the
rich JCR events functionality, and it is fairly easy to implement.

> ...- the comments shall be checked for Spam before they are written.
> Especially, comments that contain links shall be get a special property
> "suspicious"...

The above scriptable events would be a good fit for that as well.

> ...- I would like to moderate or delete comments in a batch, i.e. modify
> multiple nodes in one request...

I'd handle that with the microjax javascript client code (which is not
here yet, but I have a prototype to port, hopefully soon).

-Bertrand

Reply via email to