[commits-cosmo] (travis) [5620] Revert base64 encoding changes and change type attribute of content elements to "text/eim+json".

Travis Vachon travis at osafoundation.org
Mon Sep 10 17:45:37 PDT 2007


Note the the url for the list discussion is actually:

http://lists.osafoundation.org/archives/cosmo-dev/200709.mbox/% 
3cC1815719-417A-4650-BA50-4A1BA2C5096C at osafoundation.org%3e

-Travis

On Sep 10, 2007, at 5:37 PM, svncheckin at osafoundation.org wrote:

> Revision
> 5620
> Author
> travis
> Date
> 2007-09-10 17:37:25 -0700 (Mon, 10 Sep 2007)
> Log Message
>
> Revert base64 encoding changes and change type attribute of content  
> elements to "text/eim+json".
>
> As discussed here:
>
> http://lists.osafoundation.org/archives/cosmo-dev/200709.mbox/ajax/% 
> 3cC1815719-417A-4650-BA50-4A1BA2C5096C at osafoundation.org%3e
>
> reverting the recently checked in code that base64 encoded the body  
> of our Atom feed content elements. To maintain compatibility with  
> the Atom processing model, also changing the type attribute of the  
> content elements to "text/eim+json".
>
> As noted in the thread, this change _will not_ be commited back to  
> trunk.
> Modified Paths
>
> cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/atom/ 
> generator/ContentFactory.java
> cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/atom/ 
> processor/JsonProcessor.java
> cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/eim/json/ 
> JsonConstants.java
> cosmo/branches/0.7.2/cosmo/src/main/webapp/js/cosmo/service/ 
> translators/eim.js
> cosmo/branches/0.7.2/cosmo/src/test/functional/stress/cosmo/ 
> atom_user.rb
> cosmo/branches/0.7.2/cosmo/src/test/unit/js/cosmo/service/ 
> translators/test_eim.js
> Diff
>
> Modified: cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/ 
> atom/generator/ContentFactory.java (5619 => 5620)
>
> --- cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/atom/ 
> generator/ContentFactory.java	2007-09-10 23:41:33 UTC (rev 5619)
> +++ cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/atom/ 
> generator/ContentFactory.java	2007-09-11 00:37:25 UTC (rev 5620)
> @@ -18,7 +18,6 @@
>  import java.io.StringWriter;
>  import java.util.HashSet;
>
> -import org.apache.commons.codec.binary.Base64;
>  import org.apache.commons.lang.StringEscapeUtils;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> @@ -96,11 +95,8 @@
>              writeJson(writer, item);
>              writer.close();
>
> -            byte[] bytes = out.toString().getBytes("UTF-8");
> -            String value = new String(Base64.encodeBase64(bytes),  
> "UTF-8");
> -
>              ContentBean content = new ContentBean();
> -            content.setValue(value);
> +            content.setValue(out.toString());
>              content.setMediaType(MEDIA_TYPE_EIM_JSON);
>
>              return content;
> Modified: cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/ 
> atom/processor/JsonProcessor.java (5619 => 5620)
>
> --- cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/atom/ 
> processor/JsonProcessor.java	2007-09-10 23:41:33 UTC (rev 5619)
> +++ cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/atom/ 
> processor/JsonProcessor.java	2007-09-11 00:37:25 UTC (rev 5620)
> @@ -17,10 +17,7 @@
>
>  import java.io.IOException;
>  import java.io.Reader;
> -import java.io.StringReader;
>
> -import org.apache.commons.codec.binary.Base64;
> -import org.apache.commons.io.IOUtils;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
>
> @@ -49,10 +46,7 @@
>          throws ValidationException, ProcessorException {
>          JsonStreamReader reader = null;
>          try {
> -            byte[] encoded = IOUtils.toString(content).getBytes 
> ("UTF-8");
> -            String decoded = new String(Base64.decodeBase64 
> (encoded), "UTF-8");
> -
> -            reader = new JsonStreamReader(new StringReader(decoded));
> +            reader = new JsonStreamReader(content);
>              EimRecordSet recordset = reader.nextRecordSet();
>              if (recordset == null)
>                  throw new ValidationException("No recordset read  
> from stream");
> Modified: cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/ 
> eim/json/JsonConstants.java (5619 => 5620)
>
> --- cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/eim/ 
> json/JsonConstants.java	2007-09-10 23:41:33 UTC (rev 5619)
> +++ cosmo/branches/0.7.2/cosmo/src/main/java/org/osaf/cosmo/eim/ 
> json/JsonConstants.java	2007-09-11 00:37:25 UTC (rev 5620)
> @@ -21,7 +21,7 @@
>   */
>  public interface JsonConstants {
>
> -    public static final String MEDIA_TYPE_EIM_JSON = "application/ 
> eim+json";
> +    public static final String MEDIA_TYPE_EIM_JSON = "text/eim+json";
>
>      public static final String KEY_UUID = "uuid";
>      public static final String KEY_DELETED = "deleted";
> Modified: cosmo/branches/0.7.2/cosmo/src/main/webapp/js/cosmo/ 
> service/translators/eim.js (5619 => 5620)
>
> --- cosmo/branches/0.7.2/cosmo/src/main/webapp/js/cosmo/service/ 
> translators/eim.js	2007-09-10 23:41:33 UTC (rev 5619)
> +++ cosmo/branches/0.7.2/cosmo/src/main/webapp/js/cosmo/service/ 
> translators/eim.js	2007-09-11 00:37:25 UTC (rev 5620)
> @@ -310,7 +310,7 @@
>              throw new cosmo.service.translators.
>                 ParseError("Could not find content element for  
> entry " + (i+1));
>          }
> -        var content = cosmo.util.encoding.fromBase64 
> (cosmo.util.html.getElementTextContent(contentEl));
> +        var content = cosmo.util.html.getElementTextContent 
> (contentEl);
>
>          var recordSets = dojo.json.evalJson(content);
>
> @@ -420,7 +420,7 @@
>                     ParseError("Could not find content element for  
> entry " + (i+1));
>              }
>
> -            var content = cosmo.util.encoding.fromBase64 
> (cosmo.util.html.getElementTextContent(contentElement));
> +            var content = cosmo.util.html.getElementTextContent 
> (contentElement);
>
>              var item;
>              // If we have a second part to the uid, this entry is a
> @@ -616,7 +616,7 @@
>                   '<id>urn:uuid:', dojo.string.escapeXml(this.getUid 
> (object)), '</id>',
>                   '<updated>', dojo.string.escapeXml 
> (dojo.date.toRfc3339(new Date())), '</updated>',
>                   '<author><name>', dojo.string.escapeXml 
> (cosmo.util.auth.getUsername()), '</name></author>',
> -                 '<content type="application/eim+json">',  
> cosmo.util.encoding.toBase64(dojo.json.serialize 
> (this.objectToRecordSet(object))), '</content>',
> +                 '<content type="text/eim+json"><![CDATA[',  
> dojo.json.serialize(this.objectToRecordSet(object)), ']]></content>',
>                   '</entry>'].join("");
>      },
>
> Modified: cosmo/branches/0.7.2/cosmo/src/test/functional/stress/ 
> cosmo/atom_user.rb (5619 => 5620)
>
> --- cosmo/branches/0.7.2/cosmo/src/test/functional/stress/cosmo/ 
> atom_user.rb	2007-09-10 23:41:33 UTC (rev 5619)
> +++ cosmo/branches/0.7.2/cosmo/src/test/functional/stress/cosmo/ 
> atom_user.rb	2007-09-11 00:37:25 UTC (rev 5620)
> @@ -196,7 +196,7 @@
>        <id>urn:uuid:#{uid}</id>
>        <updated>2007-06-05T10:58:15-07:00</updated>
>        <author><name>#{random_string}</name></author>
> -      <content type="application/eim+json">{"uuid":"#{uid}",
> +      <content type="text/eim+json">{"uuid":"#{uid}",
>        "records":{"item":{"prefix":"item","ns":"http:// 
> osafoundation.org/eim/item/0",
>        "key":{"uuid":["text","#{uid}"]},"fields":{"title":["text","# 
> {random_string}"]}},
>        "note":{"prefix":"note","ns":"http://osafoundation.org/eim/ 
> note/0",
> Modified: cosmo/branches/0.7.2/cosmo/src/test/unit/js/cosmo/service/ 
> translators/test_eim.js (5619 => 5620)
>
> --- cosmo/branches/0.7.2/cosmo/src/test/unit/js/cosmo/service/ 
> translators/test_eim.js	2007-09-10 23:41:33 UTC (rev 5619)
> +++ cosmo/branches/0.7.2/cosmo/src/test/unit/js/cosmo/service/ 
> translators/test_eim.js	2007-09-11 00:37:25 UTC (rev 5620)
> @@ -214,7 +214,7 @@
>          '<title type="text">Welcome to Cosmo</title>' +
>          '<updated>2007-05-01T21:01:59.535Z</ 
> updated><published>2007-05-01T21:01:59.535Z</published>' +
>          '<link rel="self" type="application/atom+xml" href="item/'  
> + uuid + '/full/eim-json" />' +
> -        '<content type="application/eim+json">' +
> +        '<content type="text/eim+json">' +
>          dojo.json.serialize(content) +
>          '</content>' +
>          '<link rel="edit" type="application/atom+xml" href="item/'  
> + uuid + '"/>' +
>
> _______________________________________________
> Commits-Cosmo mailing list
> Commits-Cosmo at osafoundation.org
> http://lists.osafoundation.org/cgi-bin/mailman/listinfo/commits-cosmo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/commits-cosmo/attachments/20070910/e34e4cf0/attachment.htm


More information about the Commits-Cosmo mailing list