Loading ...
Sorry, an error occurred while loading the content.

JSON mime type support added to open source Aptana Jaxer server

Expand Messages
  • khakman
    The latest release of Aptana s Jaxer Ajax server (Jaxer 1.0 RC B)has added support for the creation and delivery of JSON data services -- Jaxer runs JavaScript
    Message 1 of 1 , Aug 7, 2008
    View Source
    • 0 Attachment
      The latest release of Aptana's Jaxer Ajax server (Jaxer 1.0 RC B)has
      added support for the creation and delivery of JSON data services --
      Jaxer runs JavaScript natively on the server-side and includes JSON
      serialization APIs at both client and server.

      Jaxer (http://www.aptana.com/jaxer) is an open source Ajax server
      whose core is the Mozilla Firefox browser engine. (Yep a browser on
      the server). By putting a browser engine on the server-side you not
      only get server-side JavaScript, but also server-side Ajax, meaning
      full DOM and XHR access and the ability to use a full Ajax context on
      the server side. Thus you can use Ajax libraries server-side too if
      you like. Jaxer also provides database, file system, network,
      session and security APIs to name a few.

      There's a bunch of new things in this release candidate (RC B) of
      Jaxer 1.0, but specific to JSON are two things: Support for JSON
      content types and enhanced JSON serialization.

      Jaxer has in fact had JSON support all along, but the key new thing
      is the ability to return data as a JSON content type from the Jaxer
      server. Prior to this release all you could return was HTML. Now
      you can return JSON, HTML, GIF (and other image types), XML, etcÂ…
      Many users really like the idea of using Jaxer for easily creating
      JSON data services. This is a rapidly growing trend we're seeing with
      more and more developers discover the powerful capabilities of JSON.
      In Jaxer, JSON gets extra cool since it's all native JavaScript on
      the client, on the wire, and on the server. The enhanced JSON
      serialization adds to making JSON use even easier than before on both
      client and server. JSON services also make Jaxer very useful not
      just with Ajax, but also with other Web clients such as Flash, Flex
      or even Silverlight (where we're seeing lots of interest in JSON as
      well) since all those support JavaScript on the client and can
      consume JSON data. And since Adobe donated Tamarin to Mozilla,
      Adobe's stuff and Firefox are clearly set for convergence in regards
      to JavaScript support.

      Greg Murray, (formerly Sun's Ajax Architect & creator of the jMaki
      Ajax libraries is now at Aptana) announced the news on the Aptana
      blog: http://aptana.com/blog/gmurray/jaxer_1_0_release_candidate_b.
      Greg as you might know is a huge proponent of JSON in his jMaki work
      and will only be putting increasing focus on JSON as he further the
      Jaxer project for Aptana.

      Here's a commented snippet of code for how it works (and some of you
      might notice the myJSONstring values from some examples at
      json.org)...

      <script language="JavaScript" runat="server">
      // runat=server tells Jaxer to runs this JS on the server-side.
      There are about 8 runat values.

      Jaxer.response.addHeader("Content-Type","text/javascript",true);
      //sets the content type

      var myJSONString = '{"bindings":
      [{"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
      {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
      {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}]}
      ';

      Jaxer.response.setContents(myJSONString);
      // sets the body of the response message... Voila! A JSON data
      service.

      </script>

      Of course instead of the myJSONSTring, you could use
      Jaxer.Serialization.toJSONString() and
      Jaxer.Serialization.fromJSONString() with full JS objects as well.
      These APIs also support the json.js techniques for these operations.

      If you want to give Jaxer a try, get Aptana Studio, an Eclipse-based
      IDE for Ajax, PHP, Ruby on Rails, and Jaxer. Jaxer comes embedded
      with full API reference, code assist and more. Or you can download
      it from Aptana's website and go at it with notepad too :)

      Have fun! Feedback and comments on these capabilities appreciated!

      --Kevin at Aptana
    Your message has been successfully submitted and would be delivered to recipients shortly.