You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by John Logan <Jo...@texture.com> on 2018/03/01 04:07:23 UTC

Sling POST servlet and empty arrays?

Hi, I'm trying to create node with an empty String[] property via the Sling POST servlet.


Patching, and adding/removing the patched property seems to work:


        curl \
                ${CACERT} \
                -s \
                -f \
                -o /dev/null \
                -w "%{http_code}\n" \
                -b ${cookies} \
                -X POST \
                -F jcr:primaryType=sling:Folder \
                -F jcr:mixinTypes=mix:versionable \
                -F 'foo@TypeHint=String[]' \
                -F 'foo@Patch=true' \
                -F 'foo=+dummy' \
                -F 'foo=-dummy' \
                /path/to/resource

Is there a more succinct and accepted way?


Thanks!  John

Re: Sling POST servlet and empty arrays?

Posted by Robert Munteanu <ro...@apache.org>.
On Thu, 2018-03-22 at 17:30 +0000, John Logan wrote:
> Hi Robert,
> 
> 
> I created a patch and made it available via:
> 
> 
> https://issues.apache.org/jira/browse/SLING-7553

Thanks, let's take it from there.

Robert

Re: Sling POST servlet and empty arrays?

Posted by John Logan <Jo...@texture.com>.
Hi Robert,


I created a patch and made it available via:


https://issues.apache.org/jira/browse/SLING-7553


Cheers... John

________________________________
From: Robert Munteanu <ro...@apache.org>
Sent: Tuesday, March 6, 2018 12:22:18 AM
To: users@sling.apache.org
Subject: Re: Sling POST servlet and empty arrays?

Hi John,

On Mon, 2018-03-05 at 17:51 +0000, John Logan wrote:
> Thanks, Bertrand, for the clarification.  I'm glad you mentioned that
> this behavior may not be strictly defined.
>
>
> I don't think I ever turned in my contributor paperwork for Apache
> and/or Sling but when I can find a little extra time I'll tackle that
> and add a test.

That would be great! Note that you don't have to sign a CLA for
submitting individual patches, although it does not hurt to have one on
file.

Robert

>
>
> John
>
>
>
> ________________________________
> From: Bertrand Delacretaz <bd...@apache.org>
> Sent: Monday, March 5, 2018 5:37:22 AM
> To: users
> Subject: Re: Sling POST servlet and empty arrays?
>
> Hi,
>
> On Thu, Mar 1, 2018 at 5:07 AM, John Logan <Jo...@texture.com>
> wrote:
> > Hi, I'm trying to create node with an empty String[] property via
> > the Sling POST servlet...
>
> ...
> > Is there a more succinct and accepted way?...
>
> I don't think so, in general the convention is that empty property
> values cause the properties to be removed.
>
> If you rely on that behavior (which I suppose is undocumented and
> just
> happened) it might be wise to contribute an automated test that
> clarifies this behavior and prevents it from going away in the
> future.
>
> -Bertrand


Re: Sling POST servlet and empty arrays?

Posted by Robert Munteanu <ro...@apache.org>.
Hi John,

On Mon, 2018-03-05 at 17:51 +0000, John Logan wrote:
> Thanks, Bertrand, for the clarification.  I'm glad you mentioned that
> this behavior may not be strictly defined.
> 
> 
> I don't think I ever turned in my contributor paperwork for Apache
> and/or Sling but when I can find a little extra time I'll tackle that
> and add a test.

That would be great! Note that you don't have to sign a CLA for
submitting individual patches, although it does not hurt to have one on
file.

Robert

> 
> 
> John
> 
> 
> 
> ________________________________
> From: Bertrand Delacretaz <bd...@apache.org>
> Sent: Monday, March 5, 2018 5:37:22 AM
> To: users
> Subject: Re: Sling POST servlet and empty arrays?
> 
> Hi,
> 
> On Thu, Mar 1, 2018 at 5:07 AM, John Logan <Jo...@texture.com>
> wrote:
> > Hi, I'm trying to create node with an empty String[] property via
> > the Sling POST servlet...
> 
> ...
> > Is there a more succinct and accepted way?...
> 
> I don't think so, in general the convention is that empty property
> values cause the properties to be removed.
> 
> If you rely on that behavior (which I suppose is undocumented and
> just
> happened) it might be wise to contribute an automated test that
> clarifies this behavior and prevents it from going away in the
> future.
> 
> -Bertrand


Re: Sling POST servlet and empty arrays?

Posted by John Logan <Jo...@texture.com>.
Thanks, Bertrand, for the clarification.  I'm glad you mentioned that this behavior may not be strictly defined.


I don't think I ever turned in my contributor paperwork for Apache and/or Sling but when I can find a little extra time I'll tackle that and add a test.


John



________________________________
From: Bertrand Delacretaz <bd...@apache.org>
Sent: Monday, March 5, 2018 5:37:22 AM
To: users
Subject: Re: Sling POST servlet and empty arrays?

Hi,

On Thu, Mar 1, 2018 at 5:07 AM, John Logan <Jo...@texture.com> wrote:
> Hi, I'm trying to create node with an empty String[] property via the Sling POST servlet...
...
> Is there a more succinct and accepted way?...

I don't think so, in general the convention is that empty property
values cause the properties to be removed.

If you rely on that behavior (which I suppose is undocumented and just
happened) it might be wise to contribute an automated test that
clarifies this behavior and prevents it from going away in the future.

-Bertrand

Re: Sling POST servlet and empty arrays?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Thu, Mar 1, 2018 at 5:07 AM, John Logan <Jo...@texture.com> wrote:
> Hi, I'm trying to create node with an empty String[] property via the Sling POST servlet...
...
> Is there a more succinct and accepted way?...

I don't think so, in general the convention is that empty property
values cause the properties to be removed.

If you rely on that behavior (which I suppose is undocumented and just
happened) it might be wise to contribute an automated test that
clarifies this behavior and prevents it from going away in the future.

-Bertrand