[ 
https://issues.apache.org/jira/browse/SLING-5975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15426545#comment-15426545
 ] 

Roland Schaer commented on SLING-5975:
--------------------------------------

[~kwin] This is useful especially when using jQuery to modify content which i 
assume might be a relatively common use-case. jQuery >= 1.3 is submitting 
multi-value fields in this form by default. As of now it's possible to switch 
back to the old behaviour by adding a request option {{traditional: true}} (see 
http://api.jquery.com/jquery.param/) but this needs to be set explicitly which 
is not obvious.

I found a more detailed reasoning about this change at 
http://benalman.com/news/2009/12/jquery-14-param-demystified.

> POST fails with modern multi-value parameter names containing brackets
> ----------------------------------------------------------------------
>
>                 Key: SLING-5975
>                 URL: https://issues.apache.org/jira/browse/SLING-5975
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Post 2.3.12
>            Reporter: Roland Schaer
>
> A POST to update a multi-valued property fails with an error message if 
> modern parameter names with trailing brackets (i.e. {{myparam[]}}) are used.
> {code:title=cURL (resty)}
> POST /content/test -F "test[]=a" -F "test[]=b" -F "test@TypeHint=String[]" -F 
> "test@Delete="
> {code}
> {code:title=error.log}
> 18.08.2016 14:29:04.282 *ERROR* [0:0:0:0:0:0:0:1 [1471523344280] POST 
> /content/test HTTP/1.1] 
> org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception 
> during response processing.
> javax.jcr.RepositoryException: Invalid name or path: test[]
>       at 
> org.apache.jackrabbit.oak.jcr.session.SessionContext.getOakPathOrThrow(SessionContext.java:359)
>       at 
> org.apache.jackrabbit.oak.jcr.session.ItemImpl.getOakPathOrThrow(ItemImpl.java:323)
>       at 
> org.apache.jackrabbit.oak.jcr.session.NodeImpl.hasProperty(NodeImpl.java:844)
>       at 
> org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.getType(SlingPropertyValueHandler.java:398)
>       at 
> org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.setPropertyAsIs(SlingPropertyValueHandler.java:284)
>       at 
> org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.setProperty(SlingPropertyValueHandler.java:158)
>       at 
> org.apache.sling.servlets.post.impl.operations.ModifyOperation.writeContent(ModifyOperation.java:411)
>       at 
> org.apache.sling.servlets.post.impl.operations.ModifyOperation.doRun(ModifyOperation.java:101)
>       at 
> org.apache.sling.servlets.post.AbstractPostOperation.run(AbstractPostOperation.java:92)
>       at 
> org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:202)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to