Hi all,

I'd like to propose an extension to the Sling POST servlet.

Use case:

Often you have multi-value properties that act as sets, i.e. they only
contain at max one value and are not a list. An example would be tags. In
this case, having to rewrite the entire array in the POST is not optimal,
sometimes you just want to say "add valueX" or "remove valueX". Our
specific use case is bulk-editing of multiple resources, where you want to
say "add or remove valueX to/from the set", regardless of whether the
certain mv property has the value or not. That should be automatically
done by the POST servlet.

Solution:

Add a new "@Patch" suffix:

my:property@TypeHint=String[]
my:property@Patch=true
my:property=+value1
my:property=-value1

When "@Patch=true" is present, each of the property values from the
request are expected to start with either "+" or "-", followed by the
actual value. These two would represent the operations you want to have
executed on the set.

WDYT? I would provide a Patch-patch ;-).

Regards,
Alex

-- 
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel




Reply via email to