You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2008/01/25 16:39:35 UTC
[jira] Created: (SLING-201) Move JsonItemWriter to
o.a.s.commons.json
Move JsonItemWriter to o.a.s.commons.json
-----------------------------------------
Key: SLING-201
URL: https://issues.apache.org/jira/browse/SLING-201
Project: Sling
Issue Type: Improvement
Reporter: Bertrand Delacretaz
Priority: Minor
Currently we have 3 JsonItemWriters:
./launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonItemWriter.java
./microsling/microsling-core/src/main/java/org/apache/sling/microsling/helpers/json/JsonItemWriter.java
./sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
The microsling one can be left alone as that'll go away soon anyway, but the other ones should move to the o.a.s.commons.json module.
Also, the writer doesn't handle multivalued properties correctly, needs this patch:
Index: sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
===================================================================
--- sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
(revision 615066)
+++ sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
(working copy)
@@ -92,6 +92,7 @@
if (!prop.getDefinition().isMultiple()) {
writeProperty(w, currentRecursionLevel, prop);
} else {
+ w.key(prop.getName());
w.array();
for(Value v : prop.getValues()) {
w.value(convertValue(v));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (SLING-201) Move JsonItemWriter to
o.a.s.commons.json
Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bertrand Delacretaz resolved SLING-201.
---------------------------------------
Resolution: Fixed
Moved the JsonItemWriter to o.a.s.commons.json, and removed it from the two other modules, in revision 615265
Also added (very basic for now) unit tests in commons/json/src/test/java/org/apache/sling/commons/json/jcr/JsonItemWriterTest.java
The bug with multiple-valued properties is also fixed and tested
> Move JsonItemWriter to o.a.s.commons.json
> -----------------------------------------
>
> Key: SLING-201
> URL: https://issues.apache.org/jira/browse/SLING-201
> Project: Sling
> Issue Type: Improvement
> Reporter: Bertrand Delacretaz
> Priority: Minor
>
> Currently we have 3 JsonItemWriters:
> ./launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/renderers/JsonItemWriter.java
> ./microsling/microsling-core/src/main/java/org/apache/sling/microsling/helpers/json/JsonItemWriter.java
> ./sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
> The microsling one can be left alone as that'll go away soon anyway, but the other ones should move to the o.a.s.commons.json module.
> Also, the writer doesn't handle multivalued properties correctly, needs this patch:
> Index: sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
> ===================================================================
> --- sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
> (revision 615066)
> +++ sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/JsonItemWriter.java
> (working copy)
> @@ -92,6 +92,7 @@
> if (!prop.getDefinition().isMultiple()) {
> writeProperty(w, currentRecursionLevel, prop);
> } else {
> + w.key(prop.getName());
> w.array();
> for(Value v : prop.getValues()) {
> w.value(convertValue(v));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.