You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2014/03/12 03:31:42 UTC

svn commit: r1576564 - in /thrift/site: content/tutorial/as3.md publish/sitemap/index.html publish/tutorial/as3/index.html publish/tutorial/index.html

Author: jfarrell
Date: Wed Mar 12 02:31:41 2014
New Revision: 1576564

URL: http://svn.apache.org/r1576564
Log:
Adding as3 tutorial

Added:
    thrift/site/content/tutorial/as3.md
Modified:
    thrift/site/publish/sitemap/index.html
    thrift/site/publish/tutorial/as3/index.html
    thrift/site/publish/tutorial/index.html

Added: thrift/site/content/tutorial/as3.md
URL: http://svn.apache.org/viewvc/thrift/site/content/tutorial/as3.md?rev=1576564&view=auto
==============================================================================
--- thrift/site/content/tutorial/as3.md (added)
+++ thrift/site/content/tutorial/as3.md Wed Mar 12 02:31:41 2014
@@ -0,0 +1,47 @@
+---
+title: "Actionscript 3.0"
+library_lang: "as3"
+---
+<%= render 'tutorial_intro' %>
+
+### Prerequisites
+
+
+### Client
+To initialize client you can use code similar to:
+
+  [snippet:tutorial/as3/src/CalculatorUI.as:lang=java:lines=42,48]
+
+### Server
+The example client above can be tested against a java tutorial server.
+
+
+### Additional Information
+
+You might find server failing due to out of memory exception. This might happen because of flash crossdomain policy. See
+next passage on how to fix this.
+
+### Flash crossdomain policy
+
+Flash does not allow movies to connect to arbitrary servers. This is done for security reasons. To override this
+restriction, however, servers' owners can create special file - crossdomain xml file, which lists the rules according to
+which some flash movies can connect to the server.
+
+Details about this behavior are listed in
+<%= link_to("Setting up a socket policy file server", "http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html") %>.
+Also, you can find a simple python/perl server script to serve this file there. For same host, you can serve
+crossdomain.xml from any port. So, you can start your RPC servers on ports 9090 and 9091, and serve polisy file from
+port 9092. To tell flash about this, you can use code from tutorial file:
+
+  [snippet:tutorial/as3/src/CalculatorUI.as:lang=java:lines=35,37]
+
+Example of crossdomain file, to allow connect to ports 9090 and 9091 from any server:
+
+<pre><code>
+&lt;?xml version="1.0"?&gt;
+&lt;!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd"&gt;
+&lt;!-- Policy file --&gt;
+&lt;cross-domain-policy&gt;
+  &lt;allow-access-from domain="*" to-ports="9090,9091" /&gt;
+&lt;/cross-domain-policy&gt;
+</code></pre>

Modified: thrift/site/publish/sitemap/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/sitemap/index.html?rev=1576564&r1=1576563&r2=1576564&view=diff
==============================================================================
--- thrift/site/publish/sitemap/index.html (original)
+++ thrift/site/publish/sitemap/index.html Wed Mar 12 02:31:41 2014
@@ -95,7 +95,7 @@
     
             <li>
 <a href="/tutorial/">Tutorial</a><ul>
-<li><a href="/tutorial/cpp/">C++</a></li>   <li><a href="/tutorial/csharp/">CSharp</a></li> <li><a href="/tutorial/d/">D</a></li>   <li><a href="/tutorial/delphi/">Delphi</a></li> <li><a href="/tutorial/go/">Go</a></li> <li><a href="/tutorial/graphviz/">Graphviz</a></li> <li><a href="/tutorial/hs/">Haskell</a></li>    <li><a href="/tutorial/java/">Java</a></li> <li><a href="/tutorial/js/">Javascript</a></li> <li><a href="/tutorial/nodejs/">Node.js</a></li>    <li><a href="/tutorial/ocaml/">OCaml</a></li>   <li><a href="/tutorial/perl/">Perl</a></li> <li><a href="/tutorial/php/">PHP</a></li>   <li><a href="/tutorial/py/">Python</a></li> <li><a href="/tutorial/rb/">Ruby</a></li>
+<li><a href="/tutorial/as3/">Actionscript 3.0</a></li>  <li><a href="/tutorial/cpp/">C++</a></li>   <li><a href="/tutorial/csharp/">CSharp</a></li> <li><a href="/tutorial/d/">D</a></li>   <li><a href="/tutorial/delphi/">Delphi</a></li> <li><a href="/tutorial/go/">Go</a></li> <li><a href="/tutorial/graphviz/">Graphviz</a></li> <li><a href="/tutorial/hs/">Haskell</a></li>    <li><a href="/tutorial/java/">Java</a></li> <li><a href="/tutorial/js/">Javascript</a></li> <li><a href="/tutorial/nodejs/">Node.js</a></li>    <li><a href="/tutorial/ocaml/">OCaml</a></li>   <li><a href="/tutorial/perl/">Perl</a></li> <li><a href="/tutorial/php/">PHP</a></li>   <li><a href="/tutorial/py/">Python</a></li> <li><a href="/tutorial/rb/">Ruby</a></li>
 </ul>
 </li>
     

Modified: thrift/site/publish/tutorial/as3/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/tutorial/as3/index.html?rev=1576564&r1=1576563&r2=1576564&view=diff
==============================================================================
--- thrift/site/publish/tutorial/as3/index.html (original)
+++ thrift/site/publish/tutorial/as3/index.html Wed Mar 12 02:31:41 2014
@@ -66,11 +66,9 @@
 </div>
 
   	<div class="container">
-		<h2>As3 Tutorial</h2>
+		<h2>Actionscript 3.0 Tutorial</h2>
 
-<hr>
-
-<h3>Introduction</h3>
+<hr><h3>Introduction</h3>
 
 <p>All Apache Thrift tutorials require that you have:</p>
 
@@ -83,18 +81,55 @@
 </code></pre>
 </li>
 <li><p>Followed all prerequesets listed</p></li>
-</ol>
-
-<h3>Prerequisites</h3>
+</ol><h3>Prerequisites</h3>
 
 <h3>Client</h3>
 
-<pre><code class="language-java"></code></pre>
+<p>To initialize client you can use code similar to:</p>
+
+<div class="CodeRay"><div class="code"><pre><code class="language-java">    <span style="color:#088;font-weight:bold">private</span> function initConnection():<span style="color:#339;font-weight:bold">void</span> {
+      mTransport = <span style="color:#080;font-weight:bold">new</span> TSocket(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">127.0.0.1</span><span style="color:#710">"</span></span>, <span style="color:#00D">9090</span>); <span style="color:#777">// we connect to server</span>
+      mTransport.open();
+      <span style="color:#777">// initialize protocol:</span>
+      var protocol:TProtocol = <span style="color:#080;font-weight:bold">new</span> TBinaryProtocol(mTransport, <span style="color:#069">false</span>, <span style="color:#069">false</span>);
+      mCalculatorClient = <span style="color:#080;font-weight:bold">new</span> CalculatorImpl(protocol); <span style="color:#777">// finally, we create calculator client instance</span>
+    }</code></pre></div></div>
 
 <h3>Server</h3>
 
-<h2>Additional Information</h2>
+<p>The example client above can be tested against a java tutorial server.</p>
+
+<h3>Additional Information</h3>
 
+<p>You might find server failing due to out of memory exception. This might happen because of flash crossdomain policy. See
+next passage on how to fix this.</p>
+
+<h3>Flash crossdomain policy</h3>
+
+<p>Flash does not allow movies to connect to arbitrary servers. This is done for security reasons. To override this
+restriction, however, servers' owners can create special file - crossdomain xml file, which lists the rules according to
+which some flash movies can connect to the server.</p>
+
+<p>Details about this behavior are listed in
+<a href="http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html">Setting up a socket policy file server</a>.
+Also, you can find a simple python/perl server script to serve this file there. For same host, you can serve
+crossdomain.xml from any port. So, you can start your RPC servers on ports 9090 and 9091, and serve polisy file from
+port 9092. To tell flash about this, you can use code from tutorial file:</p>
+
+<div class="CodeRay"><div class="code"><pre><code class="language-java">    <span style="color:#088;font-weight:bold">private</span> function initSecurity():<span style="color:#339;font-weight:bold">void</span> {
+      <span style="color:#0a8;font-weight:bold">Security</span>.loadPolicyFile(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">xmlsocket://127.0.0.1:9092</span><span style="color:#710">"</span></span>);
+    }</code></pre></div></div>
+
+<p>Example of crossdomain file, to allow connect to ports 9090 and 9091 from any server:</p>
+
+<pre><code>
+&lt;?xml version="1.0"?&gt;
+&lt;!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd"&gt;
+&lt;!-- Policy file --&gt;
+&lt;cross-domain-policy&gt;
+  &lt;allow-access-from domain="*" to-ports="9090,9091" /&gt;
+&lt;/cross-domain-policy&gt;
+</code></pre>
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/tutorial/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/tutorial/index.html?rev=1576564&r1=1576563&r2=1576564&view=diff
==============================================================================
--- thrift/site/publish/tutorial/index.html (original)
+++ thrift/site/publish/tutorial/index.html Wed Mar 12 02:31:41 2014
@@ -104,6 +104,10 @@ See the <a href="/docs/BuildingFromSourc
 
 <ul>
 <li>
+        <a href="/tutorial/as3/">Actionscript 3.0</a>
+    </li>
+
+    <li>
         <a href="/tutorial/cpp/">C++</a>
     </li>