You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Paul Lindner (JIRA)" <ji...@apache.org> on 2009/02/17 23:38:59 UTC
[jira] Resolved: (SHINDIG-888) Reduce json output by making
isOwner/isViewer implicitly false
[ https://issues.apache.org/jira/browse/SHINDIG-888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Lindner resolved SHINDIG-888.
----------------------------------
Resolution: Fixed
Fix Version/s: trunk
Assignee: Paul Lindner
resolved
> Reduce json output by making isOwner/isViewer implicitly false
> --------------------------------------------------------------
>
> Key: SHINDIG-888
> URL: https://issues.apache.org/jira/browse/SHINDIG-888
> Project: Shindig
> Issue Type: Improvement
> Components: Java
> Affects Versions: trunk
> Reporter: Paul Lindner
> Assignee: Paul Lindner
> Fix For: trunk
>
>
> Hi,
> Just like to get some feedback on a simple change that reduces the size of responses to friend requests.
> Right now when you fetch you get an extreme amount of wasted output from the isOwner/isViewer fields of each person.
> We should implicitly declare that these fields are false unless set to true. This should shave off about 38 octets of data for each friend in the response.
> The JS API would not be affected as this construct is used in person.js
> return !!this.isOwner_;
> Here's a simplistic patch:
> ===================================================================
> --- java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonConverter.java (revision 737569)
> +++ java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonConverter.java (working copy)
> @@ -155,7 +155,12 @@
> try {
> Object val = getter.method.invoke(pojo, EMPTY_OBJECT);
> if (val != null) {
> - toReturn.put(getter.fieldName, translateObjectToJson(val));
> + String attribute = getter.fieldName;
> + Object value = translateObjectToJson(val);
> +
> + if (!(attribute.equals("isOwner") || attribute.equals("isViewer") && value.equals(Boolean.FALSE))) {
> + toReturn.put(attribute, value);
> + }
> }
> } catch (JSONException e) {
> throw new RuntimeException(errorMessage(pojo, getter), e);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.