<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ajaxian &#187; Remoting</title>
	<atom:link href="http://ajaxian.com/by/topic/remoting/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Tue, 22 May 2012 21:45:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
    	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Towards Secure Ajax Mashups</title>
		<link>http://ajaxian.com/archives/towards-secure-ajax-mashups</link>
		<comments>http://ajaxian.com/archives/towards-secure-ajax-mashups#comments</comments>
		<pubDate>Tue, 03 Apr 2007 23:27:10 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Remoting]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=2285</guid>
		<description><![CDATA[Ajax pioneer Brent Ashley has written a Developerworks article about making Ajax mashup secure. It looks at where it&#8217;s at today and where it&#8217;s all headed. He begins by surveying current techniques for calling external servers, such as the popular On-Demand Javascript technique. This has well-known security issues. The scalability benefit of the &#60;script&#62; tag <a href="http://ajaxian.com/archives/towards-secure-ajax-mashups">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>Ajax pioneer Brent Ashley has written a Developerworks article about <a href="http://www-128.ibm.com/developerworks/library/x-securemashups/">making Ajax mashup secure</a>. It looks at where it&#8217;s at today and where it&#8217;s all headed.</p>
<p><a href="http://www-128.ibm.com/developerworks/library/x-securemashups/"><img src="http://ajaxian.com/wp-content/images/ajaxcall.gif" alt="" border="0" width="473" height="134"/></a></p>
<p>He begins by surveying current techniques for calling external servers, such as the popular <a href="http://ajaxpatterns.org/On-Demand_Javascript">On-Demand Javascript</a> technique. This has well-known security issues.</p>
<blockquote>
<p>The scalability benefit of the &lt;script&gt; tag comes at the cost of sidestepping the Same Origin Policy security model, introducing potential attack vulnerabilities:</p>
<ul>
<li>Cross-site cookie access becomes possible: Scripts from one site can access cookies from another site.</li>
<li>There is no opportunity to inspect the retrieved code for safety issues before running it: The code runs immediately upon loading.</li>
</ul>
</blockquote>
<p>One short-term solution is the following IFrame fragment identifier hack.</p>
<blockquote><p>
A more recently developed content-retrieval technique employs communication between a page&#8217;s script and a hidden iframe through its src URL&#8217;s fragment identifier (the part of the URL that comes after the # sign). Scripts in the parent page and embedded iframe can set each other&#8217;s fragment identifiers despite coming from different origins. An agreed-upon communication protocol is maintained between the scripts, driven by JavaScript timers that periodically fire routines to check for changes in the fragment identifier.
</p></blockquote>
<p>We&#8217;ll hopefully see more flexible, purpose-built, solutions in the future, and <a href="http://www-128.ibm.com/developerworks/library/x-securemashups/">Brent&#8217;s article</a> summarizes the proposals under discussion &#8211; JSONRequest, &lt;module&gt; tag, content restrictions header, W3C Access Control List (ACL) System, Cross-browser.xml.</p>
<p>With all these facilities potentially in the pipeline, one can only hope there will be a clear winner that works in all major browsers, or at least enough overlap that the Ajax libs can provide a straightforward abstraction!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/towards-secure-ajax-mashups/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UED &#8211; URL Encoded Data</title>
		<link>http://ajaxian.com/archives/ued-url-encoded-data</link>
		<comments>http://ajaxian.com/archives/ued-url-encoded-data#comments</comments>
		<pubDate>Thu, 15 Mar 2007 14:20:50 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=2216</guid>
		<description><![CDATA[UED is a tiny library that takes a hash and converts it into a URL. Instead of passing a JSON string, for example, you could just construct a URL containing the transfer object. Update: I should mention that this is more about the format than the library...UED is a proposal for a standard way to <a href="http://ajaxian.com/archives/ued-url-encoded-data">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openjs.com/scripts/data/ued_url_encoded_data/">UED</a> is a tiny library that takes a hash and converts it into a URL. Instead of passing a JSON string, for example, you could just construct a URL containing the transfer object. <strong>Update:</strong> I should mention that this is more about the format than the library...UED is a proposal for a standard way to encode an object into a URL, in the same way that JSON is more a format than a library.</p>
<p>Since it assumes you are making GET calls, RESTful design would suggest only using UED for non-destructive calls (i.e. calls that don't change server state).</p>
<p>A hash is encoded like this:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-3');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-3">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">//The JS Array format of the example given above</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> arr = <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'name'</span>:<span style="color: #3366CC;">"Binny"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'year'</span>:<span style="color:#800000;">2007</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'quote'</span>:<span style="color: #3366CC;">"Hello, World!"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'os'</span>:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color: #3366CC;">'Windows'</span>,<span style="color: #3366CC;">'Linux'</span>,<span style="color: #3366CC;">'Mac'</span><span style="color:#006600; font-weight:bold;">&#93;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'software'</span>:<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'editor'</span>:<span style="color: #3366CC;">"vi"</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'audio'</span>:<span style="color: #3366CC;">"xmms"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'video'</span>:<span style="color: #3366CC;">"vlc"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> data = ued_encode<span style="color:#006600; font-weight:bold;">&#40;</span>arr<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
</ol>
</div>
</div>
</div>
<p>leading to a URL like this:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-4');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-4">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">http:<span style="color: #009900; font-style: italic;">//www.example.com/get_data.php?name=Binny&amp;year=2007&amp;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">quote=Hello%2C+World%<span style="color:#800000;">21</span>&amp;os<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>=Windows&amp;os<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>=Linux&amp;os<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>=Mac&amp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">software<span style="color:#006600; font-weight:bold;">&#91;</span>editor<span style="color:#006600; font-weight:bold;">&#93;</span>=vi&amp;software<span style="color:#006600; font-weight:bold;">&#91;</span>audio<span style="color:#006600; font-weight:bold;">&#93;</span>=xmms&amp;software<span style="color:#006600; font-weight:bold;">&#91;</span>video<span style="color:#006600; font-weight:bold;">&#93;</span>=vlc</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
</ol>
</div>
</div>
</div>
<p>However, there are no server-side decoders as yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/ued-url-encoded-data/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Eval&#8217;ing with IE&#8217;s window.execScript</title>
		<link>http://ajaxian.com/archives/evaling-with-ies-windowexecscript</link>
		<comments>http://ajaxian.com/archives/evaling-with-ies-windowexecscript#comments</comments>
		<pubDate>Wed, 31 Jan 2007 21:40:14 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=2074</guid>
		<description><![CDATA[Plaxo's Joseph Smarr has been playing with on-demand javascript, i.e. downloading extra JS code after the page has already loaded. When you grab the code via a remote call and eval() it, it doesn't get into global scope. So here's how he dealt with it. Here&#8217;s a simplified version of the situation we faced: function <a href="http://ajaxian.com/archives/evaling-with-ies-windowexecscript">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>Plaxo's Joseph Smarr has been playing with <a href="http://ajaxpatterns.org/On-Demand_Javascript">on-demand javascript</a>, i.e. downloading extra JS code after the page has already loaded. When you grab the code via a remote call and eval() it, it doesn't get into global scope. So here's how he dealt with it.</p>
<blockquote>
<p>Here&#8217;s a simplified version of the situation we faced:</p>
<pre class="code">function loadMyFuncModule() {
  // imagine this was loaded via XHR/etc
  var code = 'function myFunc() { alert("myFunc"); }';
  return eval(code); <font color="#ff0000"><strong>// doesn&#8217;t work in FF or IE</strong></font>
}

function runApp() {
  loadMyFuncModule(); // load extra code &#8220;on demand&#8221;
  myFunc(); // execute newly loaded code
}</pre>
<p>The thing to note above is that just calling eval() doesn&#8217;t stick the code in global scope in either browser. Dojo&#8217;s loader code solves this in Firefox by creating a dj_global variable that points to the global scope and then calling eval on dj_global if possible:</p>
<pre class="code">function loadMyFuncModule() {
  // imagine this was loaded via XHR/etc
  var code = 'function myFunc() { alert("myFunc"); }';
  <strong><font color="#ff0000">var dj_global = this;</font></strong> // global scope object
  return dj_global.eval ? dj_global.eval(code) : eval(code);
}</pre>
<p>This works in Firefox but not in IE (eval is not an object method in IE). So what to do? The answer turns out to be that you can use a proprietary IE method <code>window.execScript</code> to eval code in the global scope (thanks to <a href="http://www.geekportfolio.com">Ryan &#8220;Roger&#8221; Moore</a> on our team for figuring this out). The only thing to note about execScript is that it does NOT return any value (unlike eval). However when we&#8217;re just loading code on-demand, we aren&#8217;t returning anything so this doesn&#8217;t matter.</p>
<p>The final working code looks like this:</p>
<pre class="code">function loadMyFuncModule() {
  var dj_global = this; // global scope reference
  <strong><font color="#ff0000">if (window.execScript) {</font></strong>

    <strong><font color="#ff0000">window.execScript(code); // eval in global scope for IE</font></strong>
    return null; // execScript doesn&#8217;t return anything
  }
  return dj_global.eval ? dj_global.eval(code) : eval(code);
}

function runApp() {
  loadMyFuncModule(); // load extra code &#8220;on demand&#8221;
  myFunc(); // execute newly loaded code
}</pre>
<p>And once again all is well in the world.
</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/evaling-with-ies-windowexecscript/feed</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Ajax and Security &#8211; Discuss</title>
		<link>http://ajaxian.com/archives/ajax-and-security-discuss</link>
		<comments>http://ajaxian.com/archives/ajax-and-security-discuss#comments</comments>
		<pubDate>Tue, 07 Nov 2006 14:00:02 +0000</pubDate>
		<dc:creator>Rob Sanheim</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Editorial]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Remoting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[The Ajax Experience]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1779</guid>
		<description><![CDATA[Often when you hear discussions regarding Ajax and security, its said that the issues remain the same as they were ten years ago: don't trust user input, don't expose sensitive data without encryption, code for security from day one, never display system errors messages, etc. While that is all true and good, one thing I <a href="http://ajaxian.com/archives/ajax-and-security-discuss">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>Often when you hear discussions regarding Ajax and security, its said that the issues remain the same as they were ten years ago: don't trust user input, don't expose sensitive data without encryption, code for  security from day one, never display system errors messages, etc.  While that is all true and good, one thing I heard from the Ajax Experience that stuck with me is that "ajax increases the typical amount of <a href="http://cybercoyote.org/security/vectors.shtml">attack vectors</a>".  We are hitting the server more often, with different transports, and often talking to remote servers as well for services.  This will only become a bigger issue as cross domain ajax becomes more prevalent and libraries and tools make it easier to mash things up without having to know each individual services' API.  Do the developers you work with keep up to date on writing secure code?  Have you seen your ajax app exploited by cross-site scripting attacks or sql injection, or are do you consider things "safe" because you are only doing intranet work?</p>
<p>With that in mind, Michel Sutton's entry on <a href="http://portal.spidynamics.com/blogs/msutton/archive/2006/11/01/Top-10-Signs-You-Have-an-Insecure-Web-App.aspx">ten common security mistakes</a> might be a good refresher.  His earlier entry on <a href="http://portal.spidynamics.com/blogs/msutton/archive/2006/09/26/How-Prevalent-Are-SQL-Injection-Vulnerabilities_3F00_.aspx">SQL injection</a> is also worth a read, particularly if you are hand-coding sql and <strong>aren't</strong> using a database library that handles parameterized SQL statements for you (though if thats the case you might have bigger issues...)</p>
<p>Recently I went looking for an authoritative book on web app security for some fun-filled weekend reading, and came up with very few hits.  The closest I found was <a href="http://www.amazon.com/gp/product/0321369440?ie=UTF8&#038;tag=panasonicyout-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0321369440">How to Break Web Software</a><img src="http://www.assoc-amazon.com/e/ir?t=panasonicyout-20&#038;l=as2&#038;o=1&#038;a=0321369440" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> and <a href="http://www.amazon.com/gp/product/0072262990?ie=UTF8&#038;tag=panasonicyout-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0072262990">Hacking Exposed Web Applications, Second Edition</a><img src="http://www.assoc-amazon.com/e/ir?t=panasonicyout-20&#038;l=as2&#038;o=1&#038;a=0072262990" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />.  <i>How to Break Web Software</i> has a bunch of good reviews and looks to be a good high level coverage of many of the common attacks.  <i>Hacking Exposed</i> is a bit newer and has less reviews, though the first edition looked to be pretty well received.  That title and cover are pretty painful, though.  Is there an equivalent to the <a href="http://www.amazon.com/gp/product/0131103628?ie=UTF8&#038;tag=panasonicyout-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0131103628">K&#038;R C Book</a><img src="http://www.assoc-amazon.com/e/ir?t=panasonicyout-20&#038;l=as2&#038;o=1&#038;a=0131103628" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> for web app security?</p>
<p>There are a ton of books on server security and locking down your OS, but not much that targets web applications specifically.  Any other good suggestions?  Any web security blogs worth subscribing to?</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/ajax-and-security-discuss/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>New Friday for Friday: GWT</title>
		<link>http://ajaxian.com/archives/new-friday-for-friday-gwt</link>
		<comments>http://ajaxian.com/archives/new-friday-for-friday-gwt#comments</comments>
		<pubDate>Fri, 25 Aug 2006 16:19:03 +0000</pubDate>
		<dc:creator>Ben Galbraith</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1507</guid>
		<description><![CDATA[Dave Thomas over at the Pragmatic Programmer let us know about a new Friday (i.e., short book that can be read entirely in a Friday afternoon) that they've published: Google Web Toolkit, by Ed Burnette. Dave was kind enough to provide us with an excerpt for distribution to our readers: Chapter 5 -- Remote Procedure <a href="http://ajaxian.com/archives/new-friday-for-friday-gwt">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>Dave Thomas over at the <a href="http://www.pragmaticprogrammer.com/index.html">Pragmatic Programmer</a> let us know about a new <a href="http://www.pragmaticprogrammer.com/fridays.html">Friday</a> (i.e., short book that can be read entirely in a Friday afternoon) that they've published: <a href="http://www.pragmaticprogrammer.com/titles/ebgwt/index.html">Google Web Toolkit, by Ed Burnette</a>. </p>
<p>Dave was kind enough to provide us with an excerpt for distribution to our readers: <a href="http://www.ajaxian.com/downloads/rpc.pdf">Chapter 5 -- Remote Procedure Calls</a>; seems appropriate for an Ajax readership. If you've been wanting an easy way to learn more about <a href="http://code.google.com/webtoolkit/">GWT</a>, here's your chance.</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/new-friday-for-friday-gwt/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two-Way Web: Can You Stream In Both Directions?</title>
		<link>http://ajaxian.com/archives/two-way-web-can-you-stream-in-both-directions</link>
		<comments>http://ajaxian.com/archives/two-way-web-can-you-stream-in-both-directions#comments</comments>
		<pubDate>Thu, 13 Jul 2006 23:42:00 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Comet]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1355</guid>
		<description><![CDATA[Comet is mostly considered a server-to-browser thing, but how about a permanent connection in the opposite direction, from browser to server? I've been talking about this on my blog and received some interesting thoughts from Alex Russell. There are two key issues: (1) Server needs to start outputting before incoming request is finished. With a <a href="http://ajaxian.com/archives/two-way-web-can-you-stream-in-both-directions">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://http://www.softwareas.com/two-way-web-can-you-stream-in-both-directions"><img src="http://ajaxian.com/wp-content/images/duplexcomet.png" alt="" border="0" width="430" height="311"/></a></p>
<p><a href="http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications">Comet </a> is mostly considered a server-to-browser thing, but how about <a href="http://http://www.softwareas.com/two-way-web-can-you-stream-in-both-directions">a permanent connection in the opposite direction, from browser to server</a>? I've been talking about this on my blog and received some interesting thoughts from Alex Russell.</p>
<blockquote>
<p>There are two key issues:
</p>
<p>(1) Server needs to start outputting before incoming request is finished. With a specialised server, this problem could be overcome.
</p>
<p>(2) (More serious as we can't control the browser) The browser would need to upload data in a continuous stream. You can do it with Flash/Java, but I can't see how to do this with standard JS/HTML. If you use XHR, you're going to call send() and wave goodbye to the entire request...there's no support for sequencing it. Same if you submit a regular form, change IFrame's source etc. Even if you could somehow delay reading of content so it's not immediately uploaded, the browser would probably end up not sending anything at all as it would be waiting to fill up a packet.
</p>
</blockquote>
<p>Now I've seen various people mention the possibility of HTTP keep-alive, but I've never actually seen any concrete demos or techniques to take advantage of it from a script. So if you know of any ...</p>
<p>Anyway, Alex Russell says it's probably not possible, but we can get around it anyway:</p>
<blockquote><p>
So I've spent some time investigating this (as you might expect), and at<br />
the end of the day there's not much to be done aside from using Flash<br />
and their XMLSocket interface. That's an obvious possibility given the<br />
high-performance Flash communication infrastructure we have in Dojo.<br />
Doing bi-directional HTTP probably won't happen, though, but I don't<br />
think that's cause for despair. In my tests, we can get really good<br />
(relative) performance out of distinct HTTP requests so long as the<br />
content of the request is kept to a minimum and the server can process<br />
the connection fast enough. HTTP keepalive exists at a level somewhat<br />
below what's currently exposed to browsers, so if the client and server<br />
support it, frequent requests through stock XHR objects may verywell be<br />
using it anyway. We'll have to do some significant testing to determine<br />
what conjunctions of servers/clients might do this, however.
</p></blockquote>
<p>As an interesting side note, he also pointed to some work going on at http://cometd.com to build an open Comet protocol.</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/two-way-web-can-you-stream-in-both-directions/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>PHP-Based MySQL-to-JSON Converter</title>
		<link>http://ajaxian.com/archives/php-based-mysql-to-json-converter</link>
		<comments>http://ajaxian.com/archives/php-based-mysql-to-json-converter#comments</comments>
		<pubDate>Fri, 07 Jul 2006 13:23:18 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1332</guid>
		<description><![CDATA[A new PHP component by Adnan Siddiqi accepts a MySQL result set and converts it into a JSON message. MySQL To JSON: This class can be used to convert data from MySQL query results into a JavaScript expression in JavaScript Object Notation. It takes a MySQL query result handle and retrieves the query result column <a href="http://ajaxian.com/archives/php-based-mysql-to-json-converter">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>A new PHP component by Adnan Siddiqi accepts a MySQL result set and converts it into a JSON message. <a href="http://www.phpclasses.org/browse/package/3195.html">MySQL To JSON</a>:</p>
<blockquote><p>
This class can be used to convert data from MySQL query results into a JavaScript expression in JavaScript Object Notation.</p>
<p>It takes a MySQL query result handle and retrieves the query result column names and the query result data.</p>
<p>The class generates the definition of a JavaScript object in JSON that contains an array of a rows of query result data.</p>
<p>Each array element represents an object with the properties set to the query result column names. The property values are the query results for the respective row and column.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/php-based-mysql-to-json-converter/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Autcompletion Issues with Yahoo, Scriptaculous Libraries</title>
		<link>http://ajaxian.com/archives/autcompletion-issues-with-yahoo-and-scriptaculous-libraries</link>
		<comments>http://ajaxian.com/archives/autcompletion-issues-with-yahoo-and-scriptaculous-libraries#comments</comments>
		<pubDate>Thu, 22 Jun 2006 11:26:52 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Remoting]]></category>
		<category><![CDATA[Scriptaculous]]></category>
		<category><![CDATA[Toolkit]]></category>
		<category><![CDATA[Yahoo!]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1301</guid>
		<description><![CDATA[Cheng Guangnan reports on a potential issue with the autocompletion/suggestion support offered by both Yahoo UI and Scriptaculous libraries. The problem involves parallel calls - there's the potential for an initial list of suggestions to be displayed after a subequent list. His screencasts show what's going on. 1. â€œ2006â€ is typed. 2. A request of <a href="http://ajaxian.com/archives/autcompletion-issues-with-yahoo-and-scriptaculous-libraries">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>Cheng Guangnan reports on <a href="http://capxous.com/documentation/major-defeat-found-in-yahoo-ui-and-scriptaculous/">a potential issue</a> with the <a href="http://ajaxpatterns.org/Suggestion">autocompletion/suggestion</a>  support offered by both Yahoo UI and Scriptaculous libraries. The problem involves parallel calls - there's the potential for an initial list of suggestions to be displayed <i>after</i> a subequent list. His screencasts show what's going on.</p>
<p><a href="http://capxous.com/documentation/major-defeat-found-in-yahoo-ui-and-scriptaculous/"><img src="http://ajaxian.com/wp-content/images/suggestioncast.png" alt="" border="0" width="512" height="340"/></a> </p>
<blockquote><p>
   1.  â€œ2006â€ is typed.<br />
   2. A request of â€œ2006â€ sent to the server.<br />
   3. User continues typing and now â€œ200607â€ typed.<br />
   4. Another request of â€œ200607â€ sent to the server.<br />
   5. User waiting for feedback.<br />
   6. The second request return, it show the popup.<br />
   7. The first request return, it show the popup with data returned for â€œ2006â€.
</p></blockquote>
<p>If that's the case (and we haven't verified it!), the problem could be solved by some form of <a href="http://ajaxpatterns.org/Call_Tracking">Call Tracking</a>. If the first call comes back after the second, simply discard it.</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/autcompletion-issues-with-yahoo-and-scriptaculous-libraries/feed</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Is &#8220;Asynchronous&#8221; Really Used in Ajax?</title>
		<link>http://ajaxian.com/archives/is-asynchronous-really-used-in-ajax</link>
		<comments>http://ajaxian.com/archives/is-asynchronous-really-used-in-ajax#comments</comments>
		<pubDate>Tue, 13 Jun 2006 11:38:23 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Remoting]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1271</guid>
		<description><![CDATA["A" may stand for Asynchronous, but PPK recently asked his readers if people are really exploiting the asynchronous nature of Ajax. Are there really situations where the user can do something while a request takes place? For instance, GMail makes an asynchronous call to grab some mail data - do you actually play around with <a href="http://ajaxian.com/archives/is-asynchronous-really-used-in-ajax">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>"A" may stand for Asynchronous, but <a href="http://www.quirksmode.org/blog/archives/2006/06/is_asynchronous.html">PPK recently asked his readers</a> if people are really exploiting the asynchronous nature of Ajax. Are there really situations where the user can do something while a request takes place? For instance, GMail makes an asynchronous call to grab some mail data - do you actually play around with other controls while the data downloads? Probably not. So he's wondering...</p>
<blockquote><p>
(W)hether asynchronous communication is all that it's cracked up to be from a practical point of view. If in practice it's not useful to initiate a new request while waiting for the response to a previous request, Ajax's main user interface advantage is kind of nullified.
</p></blockquote>
<p>The comments to that post indicate there <b>are</b> indeed practical uses of asynchrony ... he's subsequently summarized <a href="http://www.quirksmode.org/blog/archives/2006/06/ajax_use_patter.html">four kinds of asynchronous usage</a>:</p>
<ul>
<li> Sending data to the server (AKA fire-and-forget)
</li>
<li> Refreshing data (AKA polling, <a href="http://ajaxpatterns.org/Periodic_Refresh">Periodic Refresh</a>)
</li>
<li>This is the (as yet single) example of Ajax as I always supposed it would work: quietly but incessantly refreshing the page content based on repeated user actions
</li>
<li>New "pages" (AKA <a href="http://ajaxpatterns.org/Microlink">Microlink</a>)
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/is-asynchronous-really-used-in-ajax/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Reverse Ajax with DWR</title>
		<link>http://ajaxian.com/archives/reverse-ajax-with-dwr</link>
		<comments>http://ajaxian.com/archives/reverse-ajax-with-dwr#comments</comments>
		<pubDate>Wed, 24 May 2006 22:38:31 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Comet]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1212</guid>
		<description><![CDATA[More and more, Ajax apps are using various techniques to keep content fresh in the browser. Essentially, we're talking about reversing the usual communication flow- the server notices something's happened, and wants to tell the browser about it. Server "calls" browser, not browser calls server. The popular Java Ajax framework, DWR, recently released milestone 2 <a href="http://ajaxian.com/archives/reverse-ajax-with-dwr">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>More and more, Ajax apps are using <a href="http://ajaxpatterns.org/Periodic_Refresh">various</a> <a href="http://ajaxpatterns.org/HTTP_Streaming">techniques</a> to keep content fresh in the browser. Essentially, we're talking about reversing the usual communication flow- the server notices something's happened, and wants to tell the browser about it. Server "calls" browser, not browser calls server.</p>
<p>The popular Java Ajax framework, DWR, recently released milestone 2 towards a 2.0 release, and introduced the term "Reverse Ajax" in the process, to capture this high-level pattern. <a href="http://prokata.com/reverseajax">This article</a> (via <a href="http://getahead.ltd.uk/blog/joe/2006/05/24/1148505279843.html">Joe Walker</a>) abstracts the communication details behind a clean API, so you can easily switch between three different implementations of Reverse Ajax:</p>
<p><img src="http://ajaxian.com/wp-content/images/dwr.gif" alt="" border="0" width="200" height="169" class="alignright" /> </p>
<blockquote>
<p>
<strong>1. Polling</strong>: This is where the browser makes a request of the server at regular and frequent intervals, say every 3 seconds to see if there has been an update to the page. To illustrate imagine a 5 year old (or a <a href="http://www.moviesoundclips.net/movies/shrek2/wethereyet2.wav">donkey</a>) in the back of the car shouting 'are we there yet?' every few seconds and you get the picture.
</p>
<p><strong>2. Comet, long lived Http, or the slow load technique</strong>: Are all names for the same thing. As already mentioned, the server has to wait for the browser to make contact. But this technique allows the server to <strong>start</strong> answering the browser's request for information very slowly. Extremely slowly. Actually in the same way I used to answer my French teachers at school, it starts the reply but never actually finishes. This allows the server to keep a communications channel open (unlike me and my French teacher) to pass down additional information when the time comes. The closest we currently get to a server push. See <a href="http://alex.dojotoolkit.org/?p=545">Alex Russell's</a> article for the coining of the phrase and outline of definition of Comet. See <a href="http://www.obviously.com/tech_tips/slow_load_technique">Bryce Nesbitt's</a> for a brief description and simple demo of slow-load.
</p>
<p>
<strong>3. PiggyBack Technique</strong>: Here the server, having an update to send, waits for the next time the browser asks it a question and... pounce, sends the answer and the update. This technique is well understood in long term relationships and is usually preceded by 'and another thing.' You know, you ask what you thought was a straight forward question and get a lot more than you bargained for.
</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/reverse-ajax-with-dwr/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>KingPing: Blog Notification with Ajax</title>
		<link>http://ajaxian.com/archives/kingping-blog-notification-with-ajax</link>
		<comments>http://ajaxian.com/archives/kingping-blog-notification-with-ajax#comments</comments>
		<pubDate>Mon, 17 Apr 2006 12:17:30 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Remoting]]></category>
		<category><![CDATA[Showcase]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1091</guid>
		<description><![CDATA[King Ping provides a similar service to sites like Ping-O-Matic, which accept a blog URL and notify sites like Technorati that an update has occurred. Not everyone needs these services anymore as the process is often automated, but for those who do, King Ping gives you a nice Ajax interface for it. The application uses <a href="http://ajaxian.com/archives/kingping-blog-notification-with-ajax">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://kping.com">King Ping</a> provides a similar service to sites like <a href="http://pingomatic.com">Ping-O-Matic</a>, which accept a blog URL and notify sites like Technorati that an update has occurred. Not everyone needs these services anymore as the process is often automated, but for those who do, King Ping gives you a nice Ajax interface for it.</p>
<p>The application uses <a href="http://ajaxpatterns.org/Multi-Stage_Download">Multi-Stage Download</a> - an XHR request is uploaded for each engine to be notified. The King Ping service at the other end then acts as a <a href="http://ajaxpatterns.org/Cross-Domain_Proxy">Cross-Domain Proxy</a>, routing the call toward an engine and passing back the result to the browser. In the web page's results area, there's a designated status area for each engine, which gets filled as soon as the browser receives the corresponding response.</p>
<p>Joe Anderson, who "pinged" us about it, says <a href="http://joeanderson.co.uk/blog/2006/04/17/king-ping-an-ajax-pinger/">there are still issues</a> with King Ping.</p>
<blockquote><p>
King Pingâ€™s AJAX runs very smoothly, though I donâ€™t like the fonts and colours used throughout the site. For some reason, I find the constant use of grey quite depressing; and I think a nice blue gradient would revamp the site.</p>
<p>King Ping has a few other faults. It claims to be able to ping BlogShares, but in fact it canâ€™t. BlogShares RPC is only available to approved parties (Pingoat and Ping-O-Matic), so BlogShares refuses connections from anyone else. Another fault is it doesnâ€™t provide an RPC. This stops you adding it to your blogging software to automatically ping after each update. Ping-O-Matic and Pingoat, however, do offer RPCs.
</p></blockquote>
<p><a href="http://kping.com"><img src="http://ajaxian.com/wp-content/images/kingping.png" alt="" border="0" width="425" height="419"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/kingping-blog-notification-with-ajax/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>XHR SQL Injection: Ajax Antipattern Illustrated</title>
		<link>http://ajaxian.com/archives/xhr-sql-injection-ajax-antipattern-illustrated</link>
		<comments>http://ajaxian.com/archives/xhr-sql-injection-ajax-antipattern-illustrated#comments</comments>
		<pubDate>Thu, 13 Apr 2006 00:08:12 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Remoting]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=1084</guid>
		<description><![CDATA[Some of you will be familiar with TheDailyWTF.com, a website showcasing code in the wild that is, well, less than professional. A recent forum item illustrates the ultimate Ajax antipattern: uploading arbitrary code to be executed on the server. Gustavo Carvalho discovered what happens when XMLHttpRequest and the Eval() function in PHP are combined. I'll <a href="http://ajaxian.com/archives/xhr-sql-injection-ajax-antipattern-illustrated">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://thedailyajaxian.com/forums/68115/ShowPost.aspx"><img src="http://ajaxian.com/wp-content/images/ajaxian.gif" alt="" border="0" width="424" height="90"/></a> </p>
<p>Some of you will be familiar with TheDailyWTF.com, a website showcasing code in the wild that is, well, less than professional. A recent forum item illustrates the ultimate Ajax antipattern: <a href="http://thedailyajaxian.com/forums/68115/ShowPost.aspx">uploading arbitrary code to be executed on  the server</a>.</p>
<blockquote><p>
Gustavo Carvalho discovered what happens when XMLHttpRequest and the Eval() function in PHP are combined. I'll leave it to your immagination as to what the server-side looks like ...</p>
<p>var code =<br />
  '  $cn = mssql_connect($DB_SERVER, $DB_USERNAME, $DB_PASSWORD)           ' +<br />
  '          or die("ERROR: Cannot Connect to $DB_SERVER");                ' +<br />
  '  $db = mssql_select_db($DB_NAME, $cn);<br />
...<br />
<strong>execPhp(code);</strong>
</p></blockquote>
<p>Still, you've got to admit the remote execution is nicely encapsulated in that little execPhp() function - no messing around with XHR here ;-).</p>
<p>(Thanks <a href="http://outofhanwell.com/blog/">Matthias</a>.)</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/xhr-sql-injection-ajax-antipattern-illustrated/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>JSONRequest: Proposal for Cross-Domain Browser Service</title>
		<link>http://ajaxian.com/archives/jsonrequest-proposal-for-cross-domain-browser-service</link>
		<comments>http://ajaxian.com/archives/jsonrequest-proposal-for-cross-domain-browser-service#comments</comments>
		<pubDate>Sat, 11 Mar 2006 23:00:22 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=977</guid>
		<description><![CDATA[Douglas Crockford, creator of JSON, has proposed that browsers include a new "JSONRequest" service to allow for safe cross-domain calls. JSONRequest is a service which encodes a JavaScript value as a JSON text, does an HTTP POST of that text, gets the response, and parses the response into a JavaScript value. If the parse was <a href="http://ajaxian.com/archives/jsonrequest-proposal-for-cross-domain-browser-service">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>Douglas Crockford, creator of <a href="http://json.org">JSON</a>, has <a href="http://json.org/JSONRequest.html">proposed that browsers include a new "JSONRequest" service</a> to allow for safe cross-domain calls.</p>
<blockquote>
<p><tt>JSONRequest</tt> is a service which encodes a JavaScript value as a JSON<br />
  text, does an HTTP <tt>POST</tt> of that text, gets the response, and parses<br />
  the response into a JavaScript value. If the parse was successful, it returns<br />
  the value to the requesting script. In making the request, no  HTTP authentication or cookies are sent.<br />
  Any cookies returned by the server are discarded. The <tt>JSONRequest</tt> service<br />
  can only be used to send and receive JSON-encoded values. <tt>JSONRequest</tt><br />
  cannot be used to retrieve documents or other texts.</p>
<p><tt>JSONRequest</tt> is a global function. It takes four parameters:</p>
<table align="center">
<tbody>
<tr>
<th>parameter</th>
<th>type</th>
<th>description</th>
</tr>
<tr>
<td><tt>url</tt></td>
<td><em>string</em></td>
<td>The URL to <tt>POST</tt> to. The URL does not need to be related to the page's URL. </td>
</tr>
<tr>
<td><tt>send</tt></td>
<td><em>object</em></td>
<td>The JavaScript object or array to send as the <tt>POST</tt> data. It will<br />
      be serialized as JSON text. Cyclical structures will fail. </td>
</tr>
<tr>
<td><tt>done</tt></td>
<td><em>function (requestNumber, value, exception) </em></td>
<td>The function to be called when the request is completed. If the request was successful, the function will receive the request number and the returned value. If it is not successful, it will receive  the request number and an exception object. </td>
</tr>
<tr>
<td><tt>timeout</tt></td>
<td><em>number</em></td>
<td>The number of milliseconds to wait for the response. This parameter is optional. The default is <code>10000</code> (10 seconds). </td>
</tr>
</tbody>
</table>
</blockquote>
<p>It would be nice to have a safe component for cross-browser calls, though maybe an extension to XMLHttpRequest, not tied to a particular format like JSON, is preferable. Nevertheless, the article makes the case for a more constrained approach and lists several reasons why JSONRequest is safe enough for cross-domain requests:
</p>
<blockquote>
<ol>
<li><tt>JSONRequest</tt> does not send or receive cookies or passwords in HTTP headers. This avoids false authorization situations. Knowing the name of a site does not grant the ability to use its browser credentials.</li>
<li><tt>JSONRequest</tt> works only with JSON text. The <tt>JSONRequest</tt> cannot be used to access legacy data or documents or scripts. This avoids attacks on internal websites which assume that access is sufficient authorization. A request will fail if the response is not perfectly UTF-8 encoded. Suboptimal aliases and surrogates will fail. A request will fail if the response is not strictly in JSON format. A request will fail if the server does not respond to <tt>POST</tt> with a JSON payload.</li>
<li><tt>JSONRequest</tt> reveals very little error information. In some cases, the goal of a miscreant is to access the information that can be obtained from an error message. <tt>JSONRequest</tt> does not return this information to the requesting script. It may provide the information to the user through a log or other mechanism, but not in a form that the script can ordinarily access.</li>
<li><tt>JSONRequest</tt> accumulates random delays before acting on new requests when previous requests have failed. This is to frustrate timing analysis attacks and denial of service attacks.</li>
</ol>
</blockquote>
<p>See <a href="http://json.org/JSONRequest.html">Douglas's article</a> for all the motivation and technical details of the JSONRequest proposal.</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/jsonrequest-proposal-for-cross-domain-browser-service/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Comet ETech Slides Available</title>
		<link>http://ajaxian.com/archives/comet-etech-slides-available</link>
		<comments>http://ajaxian.com/archives/comet-etech-slides-available#comments</comments>
		<pubDate>Wed, 08 Mar 2006 21:35:58 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Comet]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=966</guid>
		<description><![CDATA[Alex Russell has posted slides for his ETech presentation on Comet. Comet (which we mentioned the other day) is Alex's new term for push-style server-to-browser communication. ETech Comet Presentation - PDF Version ETech Comet Presentation - Flash Version The presentation motivates Comet largely in terms of social and multi-user concerns, before moving onto the nuts <a href="http://ajaxian.com/archives/comet-etech-slides-available">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>Alex Russell <a href="http://alex.dojotoolkit.org/?p=547">has posted</a> slides for his ETech presentation on Comet. <a href="http://alex.dojotoolkit.org/?p=545">Comet</a> (which <a href="http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications">we mentioned</a> the other day) is Alex's new term for push-style server-to-browser communication.</p>
<ul>
<li><a href="http://alex.dojotoolkit.org/wp-content/LowLatencyData.pdf">ETech Comet Presentation - PDF Version</a>
</li>
<li><a href="http://alex.dojotoolkit.org/wp-content/LowLatencyData.html">ETech Comet Presentation - Flash Version</a>
</li>
</ul>
<p><a href="http://alex.dojotoolkit.org/?p=547"><img src="http://ajaxian.com/wp-content/images/etechcomet.png" alt="" border="0" width="430" height="311"/></a></p>
<p>The presentation motivates Comet largely in terms of social and multi-user concerns, before moving onto the nuts and bolts.</p>
<blockquote>
<ul>
<li>Ajax is <em>me</em> driven ... Social apps are also driven by others</li>
<li>To any user, the server <em>is</em> other users.</li>
<li>If the web is a conversation ... then stale context kills.</li>
<li>Today's web servers won't cut it</li>
</ul>
</blockquote>
<p>Check out the slides for Alex's practical advice on implementing Comet. We can only hope the talk will find its way on an ETech podcast feed!</p>
<p><strong>Related:</strong></p>
<ul>
<li>Alex has also posted slides for his <a href="http://alex.dojotoolkit.org/?p=546">ETech Ajax presentation</a>.</li>
<li>I recently put up a <a href="http://www.softwareas.com/comet-podcast">podcast on Comet and the push-poll trade-offs</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/comet-etech-slides-available/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Comet: A New Approach to Ajax Applications</title>
		<link>http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications</link>
		<comments>http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications#comments</comments>
		<pubDate>Sat, 04 Mar 2006 20:06:13 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Comet]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=945</guid>
		<description><![CDATA[Alex Russell has coined a term for a flavour of Ajax that's been getting more attention of late. Comet describes applications where the server keeps pushing - or streaming - data to the client, instead of having the browser keep polling the server for fresh content. Alex identifies several buzzworthy examples: GMail&#8217;s GTalk integration Jot <a href="http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://alex.dojotoolkit.org/?p=545">Alex Russell has coined a term</a> for a flavour of Ajax that's been getting more attention of late. <b>Comet</b> describes applications where the server keeps pushing - or <a href="http://ajaxpatterns.org/HTTP_Streaming">streaming</a> - data to the client, instead of having the browser <a href="http://ajaxpatterns.org/Periodic_Refresh">keep polling</a> the server for fresh content. Alex identifies several buzzworthy examples:</p>
<blockquote>
<ul>
<li><a href="http://mail.google.com/mail/help/chat.html">GMail&#8217;s GTalk integration</a></li>
<li><a href="http://jotlive.com">Jot Live</a></li>
<li><a href="http://renkoo.com">Renkoo</a></li>
<li><a href="http://cgiirc.sourceforge.net/">cgi:irc</a></li>
<li><a href="http://meebo.com">Meebo</a></li>
</ul>
</blockquote>
<p>Comet uses a modified form of the <a href="http://www.adaptivepath.com/publications/essays/archives/000385.php">canonical Ajax architecture</a>:</p>
<p><a href="http://alex.dojotoolkit.org/?p=545"><img src="http://ajaxian.com/wp-content/images/comet.png" alt="" border="0" width="507" height="745"/></a></p>
<blockquote><p>
As is illustrated above, Comet applications can deliver data to the client at any time, not only in response to user input. The data is delivered over a single, previously-opened connection. This approach reduces the latency for data delivery significantly.</p>
<p>The architecture relies on a view of data which is event driven on both sides of the HTTP connection. Engineers familiar with SOA or message oriented middleware will find this diagram to be amazingly familiar. The only substantive change is that the endpoint is the browser.</p>
<p>While Comet is similar to Ajax in that itâ€™s asynchronous, applications that implement the Comet style can communicate state changes with almost negligible latency. This makes it suitable for many types of monitoring and multi-user collaboration applications which would otherwise be difficult or impossible to handle in a browser without plugins.
</p></blockquote>
<p>Like Ajax, Comet's a pattern that's been around for a while, but Alex felt there was no suitable name for it, to help describe the problems and solutions growing around it: "(I)n the spirit of improved communication (and not technology invention), Iâ€™m proposing a new name for this stuff"</p>
<p>The article explains why Comet is better for users (responsive) and how it can scale. He also points out that <a href="http://dojotoolkit.com">Dojo</a> has supported Comet-style architecture for some time.</p>
<p>As a sidenote, it's interesting that 37Signals' <a href="http://campfirenow.com">Campfire</a> chat app went with polling as opposed to &quot;Comet&quot; architecture - it polls the server every three seconds for new messages. Since 37Signals presumably has similar constraints to Meebo or JotSpot, why would they prefer polling? More generally, when to use polling and when to use Comet?</p>
<p>(UPDATE: We recently interviewed Jamis Buck of 37signals and addressed the push versus poll question. The answer is less about technology and more about following the agile development process -- more on that when we post the cast in the coming weeks. - Ben)</p>
<p>Remember the <a href="http://www.wired.com/wired/archive/5.03/ff_push.html">Push</a> vision?<br />
<a href="http://www.wired.com/wired/archive/5.03/ff_push.html"><img src="http://ajaxian.com/wp-content/images/push.jpg" alt="" border="0" width="69" height="83" align="right"/></a></p>
<blockquote><p>
(A) new medium is arising, surging across the Web in the preferred, many-to-many way: anything flows from anyone to anyone - from anywhere to anywhere - anytime. In other words, a true network like the telephone system, rather than a radiating system like radio or TV. This new medium doesn't wait for clicks. It doesn't need computers. It means personalized experiences not bound by a page - think of a how-to origami video channel or a 3-D furry-muckers VR space. It means information that cascades, not just through a PC, but across all forms of communication devices - headlines sent to a pager, or a traffic map popping up on a cellular phone. And it means content that will not hesitate to find you - whether you've clicked on something recently or not.</p>
<p>-- Wired, March 1997.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications/feed</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>Cross-Domain XML</title>
		<link>http://ajaxian.com/archives/xml-messages-with-cross-domain-json</link>
		<comments>http://ajaxian.com/archives/xml-messages-with-cross-domain-json#comments</comments>
		<pubDate>Wed, 15 Feb 2006 15:40:32 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=874</guid>
		<description><![CDATA[Like it or not, there's plenty of people who want to do cross-domain remoting. The typical technique is via script tags, and since this means the response must be valid Javascript, JSON is usually the message format. But what if you want to grab some XML instead of a JSON-formatted object? Dave Johnson explains how <a href="http://ajaxian.com/archives/xml-messages-with-cross-domain-json">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://ajaxian.com/archives/debunking-strong-misconceptions-about-cross-domain-ajax-security-issues">Like it or not</a>, there's plenty of people who want to do cross-domain remoting. The typical technique is via <a href="http://ajaxpatterns.org/On-Demand_Javascript"><tt>script</tt> tags</a>, and since this means the response must be valid Javascript, <a href="http://json.org">JSON</a> is usually the message format. But what if you want to grab some XML instead of a JSON-formatted object? Dave Johnson explains <a href="http://blogs.ebusiness-apps.com/dave/?p=92">how to achieve cross-domain XML</a>, building on the standard <tt>script</tt> tag trick.</p>
<p>The server responds with a script that includes the XML string, along with some code to convert it to a DOM object ... as Dave's code shows, XMLHttpRequest is not the only way to make such a conversion:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-6');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-6">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> eba_ajax_xmlp = <span style="color:#006600; font-weight:bold;">&#123;</span>x: <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; eba_ajax_xmlp.<span style="color: #006600;">loadXml</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color:#006600; font-weight:bold;">&#40;</span>s, uid<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span>document.<span style="color: #006600;">implementation</span> &amp;&amp; document.<span style="color: #006600;">implementation</span>.<span style="color: #006600;">createDocument</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> objDOMParser = <span style="color: #003366; font-weight: bold;">new</span> DOMParser<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">x</span><span style="color:#006600; font-weight:bold;">&#91;</span>uid<span style="color:#006600; font-weight:bold;">&#93;</span> = objDOMParser.<span style="color: #006600;">parseFromString</span><span style="color:#006600; font-weight:bold;">&#40;</span>s, <span style="color: #3366CC;">"text/xml"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>window.<span style="color: #006600;">ActiveXObject</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">x</span><span style="color:#006600; font-weight:bold;">&#91;</span>uid<span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">'MSXML2.DOMDocument.3.0'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">x</span><span style="color:#006600; font-weight:bold;">&#91;</span>uid<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color: #006600;">async</span> = <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">x</span><span style="color:#006600; font-weight:bold;">&#91;</span>uid<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color: #006600;">loadXML</span><span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
</ol>
</div>
</div>
</div>
<p>If it's a DOM object you're after, I guess there's an alternative strategy here too: pull down a JSON-formatted DOM object.</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/xml-messages-with-cross-domain-json/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Apache Struts-Shale and Simple Ajax</title>
		<link>http://ajaxian.com/archives/apache-struts-shale-and-simple-ajax</link>
		<comments>http://ajaxian.com/archives/apache-struts-shale-and-simple-ajax#comments</comments>
		<pubDate>Thu, 19 Jan 2006 15:37:33 +0000</pubDate>
		<dc:creator>Dion Almaer</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/archives/apache-struts-shale-and-simple-ajax</guid>
		<description><![CDATA[David Geary has announced a new remoting package for Shale, the Java framework that sits on top of JavaServer Faces. Now with one JS function you can access your managed beans on the server side: PLAIN TEXT JAVASCRIPT: &#160; function zipChanged&#40;zip&#41; &#123; &#160; &#160;sendRequest&#40;"http://localhost:8080/struts-shale-usecases/" + &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;"dynamic/remoting$business/cityAndStateForZip.faces" + &#160; <a href="http://ajaxian.com/archives/apache-struts-shale-and-simple-ajax">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>David Geary has <a href="http://jroller.com/page/dgeary?entry=shale_approaches_1_0_simplifies">announced a new remoting package</a> for <a href="http://struts.apache.org/struts-shale/">Shale</a>, the Java framework that sits on top of JavaServer Faces.</p>
<p>Now with one JS function you can access your managed beans on the server side:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-8');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-8">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> zipChanged<span style="color:#006600; font-weight:bold;">&#40;</span>zip<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;sendRequest<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">"http://localhost:8080/struts-shale-usecases/"</span> +</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #3366CC;">"dynamic/remoting$business/cityAndStateForZip.faces"</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #3366CC;">"?zip="</span> + escape<span style="color:#006600; font-weight:bold;">&#40;</span>zip<span style="color:#006600; font-weight:bold;">&#41;</span>, </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;processZipCodeSelection<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="color:#000000; font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
</ol>
</div>
</div>
</div>
<p>The preceeding code uses an <code>XMLHttpRequest</code> object to invoke a URL on the server. Shale intercepts the URL and turns it into a <code>cityAndStateForZip</code> method call on a managed bean named <code>remoting$business</code> (the $ is a Shale convention that has no bearing here).</p>
<p>The <code>remoting$business.cityAndStateForZip</code> method calls <code>FacesContext.responseComplete</code>, which effectively halts the JSF lifecycle, and writes an XML response to the response stream. On the client, I have some JavaScript to parse that XML response and store the corresponding city and state values in the appropriate HTML elements in the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/apache-struts-shale-and-simple-ajax/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAHAH &#8211; Cross-Domain JS Library</title>
		<link>http://ajaxian.com/archives/jahah-cross-domain-js-library</link>
		<comments>http://ajaxian.com/archives/jahah-cross-domain-js-library#comments</comments>
		<pubDate>Thu, 12 Jan 2006 13:50:14 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=729</guid>
		<description><![CDATA[With all the recent excitement about cross-domain Javascript, it was perhaps inevitable that libraries would emerge to automate the process. David Janes has produced one such library: JAHAH. The name comes from AHAH, which we posted about earlier. Amongst its features: * It is easy for web page authors to include JAHAH documents * It <a href="http://ajaxian.com/archives/jahah-cross-domain-js-library">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>With all the recent excitement about <a href="http://www.mindsack.com/uxe/dynodes/">cross</a>-<a href="http://developer.yahoo.net/common/json.html">domain </a><a href="http://ajaxpatterns.org/On-Demand_Javascript">Javascript</a>, it was perhaps inevitable that libraries would emerge to automate the process. David Janes has produced one such library: <a href="http://www.blogmatrix.com/tools/jahah/">JAHAH</a>. The name comes from <a href="http://microformats.org/wiki/rest/ahah">AHAH</a>, which we <a href="http://ajaxian.com/archives/2005/11/ahah_asychronou.html">posted about earlier</a>.</p>
<blockquote><p>
Amongst its features:</p>
<p>    * It is easy for web page authors to include JAHAH documents<br />
    * It is easy for content producers to create JAHAH documents<br />
    * JAHAH documents can be included "cross-domain", unlike most AJAX technologies (without bridging)<br />
    * JAHAH documents are search engine friendly</p>
<p>The package comes with several Python JAHAH webservices:</p>
<p>    * jahah-include â€” extract the body or a fragment of another document and return it as a JAHAH document<br />
    * jahah-feed â€” convert an RSS/Atom feed into a JAHAH document. </p>
<p>All JAHAH webservices must have a fallback mode into AHAH, making these tools useful in that environment also.
</p></blockquote>
<p>Code usage:</p>
<blockquote><p>
		Automatically load by magically marked hyperlinks</p>
<pre>
&lt;script type=&quot;text/javascript&quot; src=&quot;jahah.js&quot;>&lt;/script>
...
&lt;a rel=&quot;<b>include-jahah</b>&quot; href=&quot;http://www.example.com/jhah-service/&quot;>loading...&lt;/a></pre>
<p>		Load a JAHAH document into a element (by ID)</p>
<pre>
&lt;script type=&quot;text/javascript&quot;>
loadJSONDoc(&quot;http://www.example.com/jhah-service/&quot;, &quot;element-id&quot;)
&lt;/script></pre>
</blockquote>
<p>JAHAH is apparently the first library to support <a href="http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/">JSONP</a>, allowing the caller to influence the Javascript that will be output by the remote server.</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/jahah-cross-domain-js-library/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Yahoo! JSON API</title>
		<link>http://ajaxian.com/archives/yahoo-json-api</link>
		<comments>http://ajaxian.com/archives/yahoo-json-api#comments</comments>
		<pubDate>Fri, 16 Dec 2005 00:51:26 +0000</pubDate>
		<dc:creator>Michael Mahemoff</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Remoting]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://test.ajaxian.com/archives/yahoo-json-api</guid>
		<description><![CDATA[Simon Willison, now at Yahoo!, reports that Yahoo! has JSONified itsAPI: As of today, JSON is supported as an alternative output format for nearly all of Yahoo!'s Web Service APIs. This is a Really Big Deal, because it makes Yahoo!'s APIs available to JavaScript running anywhere on the web without any of the normal problems <a href="http://ajaxian.com/archives/yahoo-json-api">Read the rest...</a>]]></description>
			<content:encoded><![CDATA[<p>Simon Willison, now at Yahoo!, reports that <a href="http://simon.incutio.com/archive/2005/12/16/json">Yahoo! has JSONified itsAPI</a>:<br />
<blockquote>
<p>As of today, JSON is supported as an <a href="http://developer.yahoo.net/common/json.html">alternative output format</a> for nearly all of Yahoo!'s Web Service APIs. This is a <em>Really Big Deal</em>, because it makes Yahoo!'s APIs available to JavaScript running anywhere on the web without any of the <a href="http://www.xml.com/pub/a/2005/11/09/fixing-ajax-xmlhttprequest-considered-harmful.html">normal problems</a> caused by XMLHttpRequest's cross domain security policy.</p>
<p>Like JSON itself, the workaround is simple. You can append two arguments to a Yahoo! REST Web Service call:</p>
<pre><code>
&amp;output=json&amp;callback=myFunction
</code></pre>
<p>The page returned by the service will look like this:</p>
<pre><code class="javascript">
myFunction({ JSON data here });
</code></pre>
<p>You just need to define <code>myFunction</code> in your code and it will be called when the script is loaded. To make cross-domain requests, just dynamically create your script tags using the DOM</p>
</blockquote>
<p>It's good they've offered a simple callback technique, as there's no such thing on the <a href="http://del.icio.us/help/json">JSON API offered by Delicious</a> (now part of Yahoo!, coincidence or not?). A callback is more than a convenience; it's important <a href="http://ecmanaut.blogspot.com/2005/11/on-demand-cross-site-javascript.html">for the browser to know when the script has been loaded</a>, since it will sometimes be asynchronous. <a href="http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/">Bob Ippolito's JSONP idea</a>, posted here <a href="http://ajaxian.com/archives/2005/12/jsonp_json_with.html">last week</a>, is a more general way to support a callback mechanism, so it will be interesting to see if Yahoo! adopt it.</p>
<p>Are we about to see a proliferation of mashup-friendly JSON APIs? Yahoo's upped the ante here, and if others want to be all "2.0" and share their data with the world, they'll have to follow. Most API responses from Technorati, Flicker, et al, probably end up in a browser one way or the other, so sending it there directly might be the easiest thing in many cases. Of course, JSON APIs have their downsides, most importantly the security risk of running third-party scripts.</p>
<p>One thing's for sure: brace yourself for another exciting round of "Ajax is a Security Hole" :-).</p>
]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/yahoo-json-api/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

