[
https://issues.apache.org/jira/browse/SLING-533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605241#action_12605241
]
Alexander Klimetschek commented on SLING-533:
---------------------------------------------
There is one thing in the code that can be improved (in
SlingPropertyValueHelper): the list of values of the request property can never
have the length of null - RequestProperty.getStringValues() ensures this, and
it also does not make any sense with form posts, since a request parameter must
always have at least one value, otherwise it would simply not exist in the
request. So this code is superfluous (also for single-value property handling):
} else if (values.length == 0) {
// do not create new prop here, but clear existing
if (parent.hasProperty(prop.getName())) {
response.onModified(
parent.setProperty(prop.getName(), "").getPath()
);
}
> Support multi-value type hints (eg. @TypeHint=String[])
> -------------------------------------------------------
>
> Key: SLING-533
> URL: https://issues.apache.org/jira/browse/SLING-533
> Project: Sling
> Issue Type: New Feature
> Components: Servlets Post
> Reporter: Alexander Klimetschek
> Assignee: Carsten Ziegeler
> Fix For: 2.0.1
>
>
> As discussed in SLING-522, when posting a single value to a property that
> should be multi-valued, an extension to the @TypeHint is needed that allows
> the explicit definition of a multi-value type. For example, for Strings this
> would be @TypeHint=String[].
> Based on a quick look at the code, it should happen in
> o.a.s.servlets.post.impl.helper.SlingPropertyValueHandler.setPropertyAsIs().
> First of all the parsing of the getTypeHint() must be changed to look for an
> ending [] first, and then this "isMultiValued" information must be used to
> call the multi-value version of setProperty() in all cases (values.length >=
> 0).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.