Modified: websites/staging/thrift/trunk/content/tutorial/cpp.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/cpp.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/cpp.html Sat Sep 26 12:54:26
2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="c-tutorial">C++ Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="c-tutorial">C++ Tutorial<a class="headerlink" href="#c-tutorial"
title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,8 +101,20 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
-<h3 id="client">Client</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="cp">#include <iostream></span>
<span class="cp">#include <thrift/protocol/TBinaryProtocol.h></span>
@@ -133,6 +156,7 @@
<span class="p">}</span> <span class="k">catch</span> <span
class="p">(</span><span class="n">InvalidOperation</span><span
class="o">&</span> <span class="n">io</span><span class="p">)</span> <span
class="p">{</span>
<span class="n">cout</span> <span class="o"><<</span> <span
class="s">"InvalidOperation: "</span> <span class="o"><<</span>
<span class="n">io</span><span class="p">.</span><span class="n">why</span>
<span class="o"><<</span> <span class="n">endl</span><span
class="p">;</span>
<span class="c1">// or using generated operator<<: cout <<
io << endl;</span>
+ <span class="c1">// or by using std::exception native method what():
cout << io.what() << endl;</span>
<span class="p">}</span>
<span class="n">work</span><span class="p">.</span><span
class="n">op</span> <span class="o">=</span> <span
class="n">Operation</span><span class="o">::</span><span
class="n">SUBTRACT</span><span class="p">;</span>
@@ -159,17 +183,32 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/cpp/CppClient.cpp;hb=HEAD"</a>tutorial/cpp/CppClient.cpp</a>
</p>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="cp">#include
<thrift/concurrency/ThreadManager.h></span>
-<span class="cp">#include
<thrift/concurrency/PosixThreadFactory.h></span>
+<span class="cp">#include
<thrift/concurrency/PlatformThreadFactory.h></span>
<span class="cp">#include <thrift/protocol/TBinaryProtocol.h></span>
<span class="cp">#include <thrift/server/TSimpleServer.h></span>
<span class="cp">#include <thrift/server/TThreadPoolServer.h></span>
<span class="cp">#include <thrift/server/TThreadedServer.h></span>
<span class="cp">#include <thrift/transport/TServerSocket.h></span>
+<span class="cp">#include <thrift/transport/TSocket.h></span>
<span class="cp">#include <thrift/transport/TTransportUtils.h></span>
<span class="cp">#include <thrift/TToString.h></span>
+<span class="cp">#include <boost/make_shared.hpp></span>
+
<span class="cp">#include <iostream></span>
<span class="cp">#include <stdexcept></span>
<span class="cp">#include <sstream></span>
@@ -214,7 +253,7 @@
<span class="k">case</span> <span class="n">Operation</span><span
class="o">::</span><span class="nl">DIVIDE:</span>
<span class="k">if</span> <span class="p">(</span><span
class="n">work</span><span class="p">.</span><span class="n">num2</span> <span
class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span
class="p">{</span>
<span class="n">InvalidOperation</span> <span class="n">io</span><span
class="p">;</span>
- <span class="n">io</span><span class="p">.</span><span
class="n">what</span> <span class="o">=</span> <span class="n">work</span><span
class="p">.</span><span class="n">op</span><span class="p">;</span>
+ <span class="n">io</span><span class="p">.</span><span
class="n">whatOp</span> <span class="o">=</span> <span
class="n">work</span><span class="p">.</span><span class="n">op</span><span
class="p">;</span>
<span class="n">io</span><span class="p">.</span><span
class="n">why</span> <span class="o">=</span> <span class="s">"Cannot
divide by 0"</span><span class="p">;</span>
<span class="k">throw</span> <span class="n">io</span><span
class="p">;</span>
<span class="p">}</span>
@@ -222,7 +261,7 @@
<span class="k">break</span><span class="p">;</span>
<span class="k">default</span><span class="o">:</span>
<span class="n">InvalidOperation</span> <span class="n">io</span><span
class="p">;</span>
- <span class="n">io</span><span class="p">.</span><span
class="n">what</span> <span class="o">=</span> <span class="n">work</span><span
class="p">.</span><span class="n">op</span><span class="p">;</span>
+ <span class="n">io</span><span class="p">.</span><span
class="n">whatOp</span> <span class="o">=</span> <span
class="n">work</span><span class="p">.</span><span class="n">op</span><span
class="p">;</span>
<span class="n">io</span><span class="p">.</span><span
class="n">why</span> <span class="o">=</span> <span class="s">"Invalid
Operation"</span><span class="p">;</span>
<span class="k">throw</span> <span class="n">io</span><span
class="p">;</span>
<span class="p">}</span>
@@ -247,44 +286,48 @@
<span class="n">map</span><span class="o"><</span><span
class="n">int32_t</span><span class="p">,</span> <span
class="n">SharedStruct</span><span class="o">></span> <span
class="n">log</span><span class="p">;</span>
<span class="p">};</span>
-<span class="kt">int</span> <span class="n">main</span><span
class="p">()</span> <span class="p">{</span>
- <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">TProtocolFactory</span><span class="o">></span> <span
class="n">protocolFactory</span><span class="p">(</span><span
class="k">new</span> <span class="n">TBinaryProtocolFactory</span><span
class="p">());</span>
- <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">CalculatorHandler</span><span class="o">></span> <span
class="n">handler</span><span class="p">(</span><span class="k">new</span>
<span class="n">CalculatorHandler</span><span class="p">());</span>
- <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">TProcessor</span><span class="o">></span> <span
class="n">processor</span><span class="p">(</span><span class="k">new</span>
<span class="n">CalculatorProcessor</span><span class="p">(</span><span
class="n">handler</span><span class="p">));</span>
- <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">TServerTransport</span><span class="o">></span> <span
class="n">serverTransport</span><span class="p">(</span><span
class="k">new</span> <span class="n">TServerSocket</span><span
class="p">(</span><span class="mi">9090</span><span class="p">));</span>
- <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">TTransportFactory</span><span class="o">></span> <span
class="n">transportFactory</span><span class="p">(</span><span
class="k">new</span> <span class="n">TBufferedTransportFactory</span><span
class="p">());</span>
-
- <span class="n">TSimpleServer</span> <span class="n">server</span><span
class="p">(</span><span class="n">processor</span><span class="p">,</span>
<span class="n">serverTransport</span><span class="p">,</span> <span
class="n">transportFactory</span><span class="p">,</span> <span
class="n">protocolFactory</span><span class="p">);</span>
-
- <span class="cm">/**</span>
-<span class="cm"> * Or you could do one of these</span>
-
-<span class="cm"> const int workerCount = 4;</span>
-
-<span class="cm"> boost::shared_ptr<ThreadManager> threadManager
=</span>
-<span class="cm"> ThreadManager::newSimpleThreadManager(workerCount);</span>
-<span class="cm"> boost::shared_ptr<PosixThreadFactory> threadFactory
=</span>
-<span class="cm"> boost::shared_ptr<PosixThreadFactory>(new
PosixThreadFactory());</span>
-<span class="cm"> threadManager->threadFactory(threadFactory);</span>
-<span class="cm"> threadManager->start();</span>
-<span class="cm"> TThreadPoolServer server(processor,</span>
-<span class="cm"> serverTransport,</span>
-<span class="cm"> transportFactory,</span>
-<span class="cm"> protocolFactory,</span>
-<span class="cm"> threadManager);</span>
-
-<span class="cm"> TThreadedServer server(processor,</span>
-<span class="cm"> serverTransport,</span>
-<span class="cm"> transportFactory,</span>
-<span class="cm"> protocolFactory);</span>
+<span class="cm">/*</span>
+<span class="cm"> CalculatorIfFactory is code generated.</span>
+<span class="cm"> CalculatorCloneFactory is useful for getting access to the
server side of the</span>
+<span class="cm"> transport. It is also useful for making per-connection
state. Without this</span>
+<span class="cm"> CloneFactory, all connections will end up sharing the same
handler instance.</span>
+<span class="cm">*/</span>
+<span class="k">class</span> <span class="nc">CalculatorCloneFactory</span>
<span class="o">:</span> <span class="k">virtual</span> <span
class="k">public</span> <span class="n">CalculatorIfFactory</span> <span
class="p">{</span>
+ <span class="k">public</span><span class="o">:</span>
+ <span class="k">virtual</span> <span class="o">~</span><span
class="n">CalculatorCloneFactory</span><span class="p">()</span> <span
class="p">{}</span>
+ <span class="k">virtual</span> <span class="n">CalculatorIf</span><span
class="o">*</span> <span class="n">getHandler</span><span
class="p">(</span><span class="k">const</span> <span class="o">::</span><span
class="n">apache</span><span class="o">::</span><span
class="n">thrift</span><span class="o">::</span><span
class="n">TConnectionInfo</span><span class="o">&</span> <span
class="n">connInfo</span><span class="p">)</span>
+ <span class="p">{</span>
+ <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">TSocket</span><span class="o">></span> <span class="n">sock</span>
<span class="o">=</span> <span class="n">boost</span><span
class="o">::</span><span class="n">dynamic_pointer_cast</span><span
class="o"><</span><span class="n">TSocket</span><span
class="o">></span><span class="p">(</span><span
class="n">connInfo</span><span class="p">.</span><span
class="n">transport</span><span class="p">);</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"Incoming connection</span><span class="se">\n</span><span
class="s">"</span><span class="p">;</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\t</span><span class="s">SocketInfo:
"</span> <span class="o"><<</span> <span class="n">sock</span><span
class="o">-></span><span class="n">getSocketInfo</span><span
class="p">()</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\n</span><span
class="s">"</span><span class="p">;</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\t</span><span class="s">PeerHost:
"</span> <span class="o"><<</span> <span
class="n">sock</span><span class="o">-></span><span
class="n">getPeerHost</span><span class="p">()</span> <span
class="o"><<</span> <span class="s">"</span><span
class="se">\n</span><span class="s">"</span><span class="p">;</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\t</span><span class="s">PeerAddress:
"</span> <span class="o"><<</span> <span class="n">sock</span><span
class="o">-></span><span class="n">getPeerAddress</span><span
class="p">()</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\n</span><span
class="s">"</span><span class="p">;</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\t</span><span class="s">PeerPort:
"</span> <span class="o"><<</span> <span
class="n">sock</span><span class="o">-></span><span
class="n">getPeerPort</span><span class="p">()</span> <span
class="o"><<</span> <span class="s">"</span><span
class="se">\n</span><span class="s">"</span><span class="p">;</span>
+ <span class="k">return</span> <span class="k">new</span> <span
class="n">CalculatorHandler</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="k">virtual</span> <span class="kt">void</span> <span
class="n">releaseHandler</span><span class="p">(</span> <span
class="o">::</span><span class="n">shared</span><span class="o">::</span><span
class="n">SharedServiceIf</span><span class="o">*</span> <span
class="n">handler</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">delete</span> <span class="n">handler</span><span
class="p">;</span>
+ <span class="p">}</span>
+<span class="p">};</span>
+<span class="kt">int</span> <span class="n">main</span><span
class="p">()</span> <span class="p">{</span>
+ <span class="n">TThreadedServer</span> <span class="n">server</span><span
class="p">(</span>
+ <span class="n">boost</span><span class="o">::</span><span
class="n">make_shared</span><span class="o"><</span><span
class="n">CalculatorProcessorFactory</span><span class="o">></span><span
class="p">(</span><span class="n">boost</span><span class="o">::</span><span
class="n">make_shared</span><span class="o"><</span><span
class="n">CalculatorCloneFactory</span><span class="o">></span><span
class="p">()),</span>
+ <span class="n">boost</span><span class="o">::</span><span
class="n">make_shared</span><span class="o"><</span><span
class="n">TServerSocket</span><span class="o">></span><span
class="p">(</span><span class="mi">9090</span><span class="p">),</span> <span
class="c1">//port</span>
+ <span class="n">boost</span><span class="o">::</span><span
class="n">make_shared</span><span class="o"><</span><span
class="n">TBufferedTransportFactory</span><span class="o">></span><span
class="p">(),</span>
+ <span class="n">boost</span><span class="o">::</span><span
class="n">make_shared</span><span class="o"><</span><span
class="n">TBinaryProtocolFactory</span><span class="o">></span><span
class="p">());</span>
+
+ <span class="cm">/*</span>
+<span class="cm"> // if you don't need per-connection state, do the
following instead</span>
+<span class="cm"> TThreadedServer server(</span>
+<span class="cm">
boost::make_shared<CalculatorProcessor>(boost::make_shared<CalculatorHandler>()),</span>
+<span class="cm"> boost::make_shared<TServerSocket>(9090),
//port</span>
+<span class="cm">
boost::make_shared<TBufferedTransportFactory>(),</span>
+<span class="cm">
boost::make_shared<TBinaryProtocolFactory>());</span>
<span class="cm"> */</span>
- <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"Starting the server..."</span> <span
class="o"><<</span> <span class="n">endl</span><span class="p">;</span>
- <span class="n">server</span><span class="p">.</span><span
class="n">serve</span><span class="p">();</span>
- <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"Done."</span> <span class="o"><<</span> <span
class="n">endl</span><span class="p">;</span>
- <span class="k">return</span> <span class="mi">0</span><span
class="p">;</span>
-<span class="p">}</span>
+ <span class="o">/**</span>
+ <span class="o">*</span> <span class="n">Here</span> <span
class="n">are</span> <span class="n">some</span> <span
class="n">alternate</span> <span class="n">server</span> <span
class="n">types</span><span class="p">...</span>
</pre></div>
<p class='snippet_footer'>
@@ -292,21 +335,33 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/cpp/CppServer.cpp;hb=HEAD"</a>tutorial/cpp/CppServer.cpp</a>
</p>
-<h2 id="additional-information">Additional Information</h2>
-<h3 id="example-threadpool-server">Example ThreadPool Server</h3>
-<div class="codehilite"><pre> <span class="k">const</span> <span
class="kt">int</span> <span class="n">workerCount</span> <span
class="o">=</span> <span class="mi">4</span><span class="p">;</span>
-
- <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">ThreadManager</span><span class="o">></span> <span
class="n">threadManager</span> <span class="o">=</span>
- <span class="n">ThreadManager</span><span class="o">::</span><span
class="n">newSimpleThreadManager</span><span class="p">(</span><span
class="n">workerCount</span><span class="p">);</span>
- <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">PosixThreadFactory</span><span class="o">></span> <span
class="n">threadFactory</span> <span class="o">=</span>
- <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">PosixThreadFactory</span><span class="o">></span><span
class="p">(</span><span class="k">new</span> <span
class="n">PosixThreadFactory</span><span class="p">());</span>
- <span class="n">threadManager</span><span class="o">-></span><span
class="n">threadFactory</span><span class="p">(</span><span
class="n">threadFactory</span><span class="p">);</span>
- <span class="n">threadManager</span><span class="o">-></span><span
class="n">start</span><span class="p">();</span>
- <span class="n">TThreadPoolServer</span> <span class="n">server</span><span
class="p">(</span><span class="n">processor</span><span class="p">,</span>
- <span class="n">serverTransport</span><span
class="p">,</span>
- <span class="n">transportFactory</span><span
class="p">,</span>
- <span class="n">protocolFactory</span><span
class="p">,</span>
- <span class="n">threadManager</span><span
class="p">);</span>
+<h2 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h2>
+<h3 id="example-threadpool-server">Example ThreadPool Server<a
class="headerlink" href="#example-threadpool-server" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
+<div class="codehilite"><pre> <span class="k">virtual</span> <span
class="n">CalculatorIf</span><span class="o">*</span> <span
class="n">getHandler</span><span class="p">(</span><span class="k">const</span>
<span class="o">::</span><span class="n">apache</span><span
class="o">::</span><span class="n">thrift</span><span class="o">::</span><span
class="n">TConnectionInfo</span><span class="o">&</span> <span
class="n">connInfo</span><span class="p">)</span>
+ <span class="p">{</span>
+ <span class="n">boost</span><span class="o">::</span><span
class="n">shared_ptr</span><span class="o"><</span><span
class="n">TSocket</span><span class="o">></span> <span class="n">sock</span>
<span class="o">=</span> <span class="n">boost</span><span
class="o">::</span><span class="n">dynamic_pointer_cast</span><span
class="o"><</span><span class="n">TSocket</span><span
class="o">></span><span class="p">(</span><span
class="n">connInfo</span><span class="p">.</span><span
class="n">transport</span><span class="p">);</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"Incoming connection</span><span class="se">\n</span><span
class="s">"</span><span class="p">;</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\t</span><span class="s">SocketInfo:
"</span> <span class="o"><<</span> <span class="n">sock</span><span
class="o">-></span><span class="n">getSocketInfo</span><span
class="p">()</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\n</span><span
class="s">"</span><span class="p">;</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\t</span><span class="s">PeerHost:
"</span> <span class="o"><<</span> <span
class="n">sock</span><span class="o">-></span><span
class="n">getPeerHost</span><span class="p">()</span> <span
class="o"><<</span> <span class="s">"</span><span
class="se">\n</span><span class="s">"</span><span class="p">;</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\t</span><span class="s">PeerAddress:
"</span> <span class="o"><<</span> <span class="n">sock</span><span
class="o">-></span><span class="n">getPeerAddress</span><span
class="p">()</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\n</span><span
class="s">"</span><span class="p">;</span>
+ <span class="n">cout</span> <span class="o"><<</span> <span
class="s">"</span><span class="se">\t</span><span class="s">PeerPort:
"</span> <span class="o"><<</span> <span
class="n">sock</span><span class="o">-></span><span
class="n">getPeerPort</span><span class="p">()</span> <span
class="o"><<</span> <span class="s">"</span><span
class="se">\n</span><span class="s">"</span><span class="p">;</span>
+ <span class="k">return</span> <span class="k">new</span> <span
class="n">CalculatorHandler</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="k">virtual</span> <span class="kt">void</span> <span
class="n">releaseHandler</span><span class="p">(</span> <span
class="o">::</span><span class="n">shared</span><span class="o">::</span><span
class="n">SharedServiceIf</span><span class="o">*</span> <span
class="n">handler</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">delete</span> <span class="n">handler</span><span
class="p">;</span>
+ <span class="p">}</span>
</pre></div>
<p class='snippet_footer'>
Modified: websites/staging/thrift/trunk/content/tutorial/csharp.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/csharp.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/csharp.html Sat Sep 26
12:54:26 2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="csharp-tutorial">CSharp Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="csharp-tutorial">CSharp Tutorial<a class="headerlink"
href="#csharp-tutorial" title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,8 +101,20 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
-<h3 id="client">Client</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="k">using</span> <span
class="n">System</span><span class="p">;</span>
<span class="k">using</span> <span class="n">Thrift</span><span
class="p">;</span>
<span class="k">using</span> <span class="n">Thrift</span><span
class="p">.</span><span class="n">Protocol</span><span class="p">;</span>
@@ -171,7 +194,19 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/csharp/CsharpClient/CsharpClient.cs;hb=HEAD"</a>tutorial/csharp/CsharpClient/CsharpClient.cs</a>
</p>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="k">using</span> <span
class="n">System</span><span class="p">;</span>
<span class="k">using</span> <span class="n">System</span><span
class="p">.</span><span class="n">Collections</span><span
class="p">.</span><span class="n">Generic</span><span class="p">;</span>
<span class="k">using</span> <span class="n">Thrift</span><span
class="p">.</span><span class="n">Server</span><span class="p">;</span>
@@ -221,7 +256,7 @@
<span class="k">if</span> <span class="p">(</span><span
class="n">work</span><span class="p">.</span><span class="n">Num2</span> <span
class="o">==</span> <span class="mi">0</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">InvalidOperation</span> <span
class="n">io</span> <span class="o">=</span> <span class="k">new</span> <span
class="n">InvalidOperation</span><span class="p">();</span>
- <span class="n">io</span><span class="p">.</span><span
class="n">What</span> <span class="o">=</span> <span class="p">(</span><span
class="kt">int</span><span class="p">)</span><span class="n">work</span><span
class="p">.</span><span class="n">Op</span><span class="p">;</span>
+ <span class="n">io</span><span class="p">.</span><span
class="n">WhatOp</span> <span class="o">=</span> <span class="p">(</span><span
class="kt">int</span><span class="p">)</span><span class="n">work</span><span
class="p">.</span><span class="n">Op</span><span class="p">;</span>
<span class="n">io</span><span class="p">.</span><span
class="n">Why</span> <span class="o">=</span> <span class="s">"Cannot
divide by 0"</span><span class="p">;</span>
<span class="k">throw</span> <span
class="n">io</span><span class="p">;</span>
<span class="p">}</span>
@@ -231,7 +266,7 @@
<span class="k">default</span><span class="o">:</span>
<span class="p">{</span>
<span class="n">InvalidOperation</span> <span
class="n">io</span> <span class="o">=</span> <span class="k">new</span> <span
class="n">InvalidOperation</span><span class="p">();</span>
- <span class="n">io</span><span class="p">.</span><span
class="n">What</span> <span class="o">=</span> <span class="p">(</span><span
class="kt">int</span><span class="p">)</span><span class="n">work</span><span
class="p">.</span><span class="n">Op</span><span class="p">;</span>
+ <span class="n">io</span><span class="p">.</span><span
class="n">WhatOp</span> <span class="o">=</span> <span class="p">(</span><span
class="kt">int</span><span class="p">)</span><span class="n">work</span><span
class="p">.</span><span class="n">Op</span><span class="p">;</span>
<span class="n">io</span><span class="p">.</span><span
class="n">Why</span> <span class="o">=</span> <span class="s">"Unknown
operation"</span><span class="p">;</span>
<span class="k">throw</span> <span
class="n">io</span><span class="p">;</span>
<span class="p">}</span>
@@ -289,7 +324,7 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/csharp/CsharpServer/CsharpServer.cs;hb=HEAD"</a>tutorial/csharp/CsharpServer/CsharpServer.cs</a>
</p>
-<h2 id="additional-information">Additional Information</h2>
+<h2 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h2>
</div>
<div class="container">
<hr>
Modified: websites/staging/thrift/trunk/content/tutorial/d.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/d.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/d.html Sat Sep 26 12:54:26
2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="d-tutorial">D Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="d-tutorial">D Tutorial<a class="headerlink" href="#d-tutorial"
title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,8 +101,20 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
-<h3 id="client">Client</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="n">module</span> <span
class="n">server</span><span class="p">;</span>
<span class="n">import</span> <span class="n">std</span><span
class="p">.</span><span class="n">conv</span> <span class="o">:</span> <span
class="n">to</span><span class="p">;</span>
@@ -138,7 +161,7 @@
<span class="k">case</span> <span class="n">Operation</span><span
class="p">.</span><span class="nl">DIVIDE:</span>
<span class="k">if</span> <span class="p">(</span><span
class="n">work</span><span class="p">.</span><span class="n">num2</span> <span
class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span
class="p">{</span>
<span class="k">auto</span> <span class="n">io</span> <span
class="o">=</span> <span class="k">new</span> <span
class="n">InvalidOperation</span><span class="p">();</span>
- <span class="n">io</span><span class="p">.</span><span
class="n">what</span> <span class="o">=</span> <span class="n">work</span><span
class="p">.</span><span class="n">op</span><span class="p">;</span>
+ <span class="n">io</span><span class="p">.</span><span
class="n">whatOp</span> <span class="o">=</span> <span
class="n">work</span><span class="p">.</span><span class="n">op</span><span
class="p">;</span>
<span class="n">io</span><span class="p">.</span><span
class="n">why</span> <span class="o">=</span> <span class="s">"Cannot
divide by 0"</span><span class="p">;</span>
<span class="k">throw</span> <span class="n">io</span><span
class="p">;</span>
<span class="p">}</span>
@@ -146,7 +169,7 @@
<span class="k">break</span><span class="p">;</span>
<span class="k">default</span><span class="o">:</span>
<span class="k">auto</span> <span class="n">io</span> <span
class="o">=</span> <span class="k">new</span> <span
class="n">InvalidOperation</span><span class="p">();</span>
- <span class="n">io</span><span class="p">.</span><span
class="n">what</span> <span class="o">=</span> <span class="n">work</span><span
class="p">.</span><span class="n">op</span><span class="p">;</span>
+ <span class="n">io</span><span class="p">.</span><span
class="n">whatOp</span> <span class="o">=</span> <span
class="n">work</span><span class="p">.</span><span class="n">op</span><span
class="p">;</span>
<span class="n">io</span><span class="p">.</span><span
class="n">why</span> <span class="o">=</span> <span class="s">"Invalid
Operation"</span><span class="p">;</span>
<span class="k">throw</span> <span class="n">io</span><span
class="p">;</span>
<span class="p">}</span>
@@ -192,7 +215,19 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/d/server.d;hb=HEAD"</a>tutorial/d/server.d</a>
</p>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="n">module</span> <span
class="n">client</span><span class="p">;</span>
<span class="n">import</span> <span class="n">std</span><span
class="p">.</span><span class="n">stdio</span><span class="p">;</span>
@@ -246,7 +281,7 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/d/client.d;hb=HEAD"</a>tutorial/d/client.d</a>
</p>
-<h2 id="additional-information">Additional Information</h2>
+<h2 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h2>
</div>
<div class="container">
<hr>
Modified: websites/staging/thrift/trunk/content/tutorial/delphi.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/delphi.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/delphi.html Sat Sep 26
12:54:26 2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="delphi-tutorial">Delphi Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="delphi-tutorial">Delphi Tutorial<a class="headerlink"
href="#delphi-tutorial" title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,11 +101,23 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
<ul>
<li>Thrift requires at least Delphi 2010. Earlier versions and FPC will not
work due to the lack of Generics.</li>
</ul>
-<h3 id="client">Client</h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="k">program</span> <span
class="n">DelphiClient</span><span class="o">;</span>
<span class="cm">{$APPTYPE CONSOLE}</span>
@@ -198,7 +221,19 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/delphi/DelphiClient/DelphiClient.dpr;hb=HEAD"</a>tutorial/delphi/DelphiClient/DelphiClient.dpr</a>
</p>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="k">program</span> <span
class="n">DelphiServer</span><span class="o">;</span>
<span class="cm">{$APPTYPE CONSOLE}</span>
@@ -361,7 +396,7 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/delphi/DelphiServer/DelphiServer.dpr;hb=HEAD"</a>tutorial/delphi/DelphiServer/DelphiServer.dpr</a>
</p>
-<h2 id="additional-information">Additional Information</h2>
+<h2 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h2>
</div>
<div class="container">
<hr>
Modified: websites/staging/thrift/trunk/content/tutorial/go.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/go.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/go.html Sat Sep 26 12:54:26
2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="go-tutorial">Go Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="go-tutorial">Go Tutorial<a class="headerlink" href="#go-tutorial"
title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,12 +101,24 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
<ul>
<li>At least Go 1.1.x is required to run the tutorial code.</li>
<li>The GOPATH may need to be adjusted, alternatively manually put the Go
Thrift library files into a suitable location.</li>
</ul>
-<h3 id="client">Client</h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="n">import</span> <span
class="p">(</span>
<span class="s">"crypto/tls"</span>
<span class="s">"fmt"</span>
@@ -181,7 +204,19 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/go/src/client.go;hb=HEAD"</a>tutorial/go/src/client.go</a>
</p>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="n">import</span> <span
class="p">(</span>
<span class="s">"crypto/tls"</span>
<span class="s">"fmt"</span>
@@ -222,7 +257,7 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/go/src/server.go;hb=HEAD"</a>tutorial/go/src/server.go</a>
</p>
-<h2 id="additional-information">Additional Information</h2>
+<h2 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h2>
<ul>
<li>Try using one of the other available protocols, default is binary.</li>
<li>Try using the buffered and/or framed transport options.</li>
Modified: websites/staging/thrift/trunk/content/tutorial/graphviz.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/graphviz.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/graphviz.html Sat Sep 26
12:54:26 2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="graphviz-tutorial">Graphviz Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="graphviz-tutorial">Graphviz Tutorial<a class="headerlink"
href="#graphviz-tutorial" title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,14 +101,14 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
<ul>
<li>
<p>A Graphviz renderer</p>
<p>The <a href="http://www.graphviz.org">official renderers</a> can be used as
a command line tool to produce a graphic from the '.gv' file</p>
</li>
</ul>
-<h3 id="overview">Overview</h3>
+<h3 id="overview">Overview<a class="headerlink" href="#overview"
title="Permanent link">¶</a></h3>
<p>The Graphviz generator is a convenient way to generate documentation
diagrams
for your API. Usage:</p>
<div class="codehilite"><pre>$ <span class="n">thrift</span> <span
class="o">-</span><span class="n">r</span> <span class="o">--</span><span
class="n">gen</span> <span class="n">gv</span> <span
class="n">tutorial</span><span class="p">.</span><span class="n">thrift</span>
@@ -114,7 +125,7 @@ renderer in your platform.</p>
</pre></div>
-<h2 id="extra-options">Extra options</h2>
+<h2 id="extra-options">Extra options<a class="headerlink"
href="#extra-options" title="Permanent link">¶</a></h2>
<p>By default, the diagrams are not rendered with arrows from functions to
exceptions (although the exception structures are displayed). You can set the
generator to render those exceptions arrows (i.e. function throws) by using the
Modified: websites/staging/thrift/trunk/content/tutorial/haxe.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/haxe.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/haxe.html Sat Sep 26
12:54:26 2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="haxe-framework-tutorial">Haxe Framework Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="haxe-framework-tutorial">Haxe Framework Tutorial<a class="headerlink"
href="#haxe-framework-tutorial" title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,11 +101,11 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
<ul>
<li>Thrift requires at least Haxe 3.1.3. (You may try with older versions on
your own luck).</li>
</ul>
-<h3 id="client">Client</h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
<p>For this tutorial, we put both the server and the client main code into one
single program.
Depending on the arguments passed, it runs as a server or as a client
program.</p>
<p>package;</p>
@@ -236,12 +247,11 @@ import shared.</em>;</p>
<span class="o">//</span> <span class="n">optinal</span> <span
class="n">layered</span> <span class="n">transport</span>
<span class="k">if</span> <span class="p">(</span> <span
class="n">framed</span><span class="p">)</span> <span class="p">{</span>
- <span class="n">trace</span><span class="p">(</span>"<span
class="o">-</span> <span class="n">framed</span> <span
class="n">transport</span>"<span class="p">);</span>
+ <span class="n">trace</span><span class="p">(</span>"<span
class="o">-</span> <span class="n">framed</span> <span
class="n">transport</span>"<span class="p">);</span>
<span class="n">transport</span> <span class="p">=</span> <span
class="n">new</span> <span class="n">TFramedTransport</span><span
class="p">(</span><span class="n">transport</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span
class="k">if</span> <span class="p">(</span> <span
class="n">buffered</span><span class="p">)</span> <span class="p">{</span>
- <span class="n">trace</span><span class="p">(</span>"<span
class="o">-</span> <span class="n">buffered</span> <span
class="n">transport</span>"<span class="p">);</span>
- <span class="n">throw</span> "<span
class="n">TBufferedTransport</span> <span class="n">not</span> <span
class="n">implemented</span> <span class="n">yet</span>"<span
class="p">;</span>
- <span class="o">//</span><span class="n">transport</span> <span
class="p">=</span> <span class="n">new</span> <span
class="n">TBufferedTransport</span><span class="p">(</span><span
class="n">transport</span><span class="p">);</span>
+ <span class="n">trace</span><span class="p">(</span>"<span
class="o">-</span> <span class="n">buffered</span> <span
class="n">transport</span>"<span class="p">);</span>
+ <span class="n">transport</span> <span class="p">=</span> <span
class="n">new</span> <span class="n">TBufferedTransport</span><span
class="p">(</span><span class="n">transport</span><span class="p">);</span>
<span class="p">}</span>
@@ -351,12 +361,11 @@ import shared.</em>;</p>
<span class="o">//</span> <span class="n">optional</span><span
class="p">:</span> <span class="n">layered</span> <span
class="n">transport</span>
<span class="n">var</span> <span class="n">transfactory</span> <span
class="p">:</span> <span class="n">TTransportFactory</span> <span
class="p">=</span> <span class="n">null</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span> <span
class="n">framed</span><span class="p">)</span> <span class="p">{</span>
- <span class="n">trace</span><span class="p">(</span>"<span
class="o">-</span> <span class="n">framed</span> <span
class="n">transport</span>"<span class="p">);</span>
+ <span class="n">trace</span><span class="p">(</span>"<span
class="o">-</span> <span class="n">framed</span> <span
class="n">transport</span>"<span class="p">);</span>
<span class="n">transfactory</span> <span class="p">=</span> <span
class="n">new</span> <span class="n">TFramedTransportFactory</span><span
class="p">();</span>
<span class="p">}</span> <span class="k">else</span> <span
class="k">if</span> <span class="p">(</span> <span
class="n">buffered</span><span class="p">)</span> <span class="p">{</span>
- <span class="n">trace</span><span class="p">(</span>"<span
class="o">-</span> <span class="n">buffered</span> <span
class="n">transport</span>"<span class="p">);</span>
- <span class="n">throw</span> "<span
class="n">TBufferedTransport</span> <span class="n">not</span> <span
class="n">implemented</span> <span class="n">yet</span>"<span
class="p">;</span>
- <span class="o">//</span><span class="n">transfactory</span> <span
class="p">=</span> <span class="n">new</span> <span
class="n">TBufferedTransportFactory</span><span class="p">();</span>
+ <span class="n">trace</span><span class="p">(</span>"<span
class="o">-</span> <span class="n">buffered</span> <span
class="n">transport</span>"<span class="p">);</span>
+ <span class="n">transfactory</span> <span class="p">=</span> <span
class="n">new</span> <span class="n">TBufferedTransportFactory</span><span
class="p">();</span>
<span class="p">}</span>
<span class="o">//</span> <span class="n">protocol</span>
@@ -404,7 +413,7 @@ import shared.</em>;</p>
</p>
<p>Were done with the client, but need some more for the server: A service
handler implementaion.</p>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
<p>As the name suggests, the service handler implements the Thrift service on
the server side.
The code to achieve this is as follows:</p>
<p>package;</p>
@@ -451,7 +460,7 @@ import shared.</em>;</p>
<span class="k">if</span> <span class="p">(</span><span
class="n">work</span><span class="p">.</span><span class="n">num2</span> <span
class="o">==</span> 0<span class="p">)</span>
<span class="p">{</span>
<span class="n">var</span> <span class="n">io</span> <span
class="p">=</span> <span class="n">new</span> <span
class="n">InvalidOperation</span><span class="p">();</span>
- <span class="n">io</span><span class="p">.</span><span
class="n">what</span> <span class="p">=</span> <span class="n">work</span><span
class="p">.</span><span class="n">op</span><span class="p">;</span>
+ <span class="n">io</span><span class="p">.</span><span
class="n">whatOp</span> <span class="p">=</span> <span
class="n">work</span><span class="p">.</span><span class="n">op</span><span
class="p">;</span>
<span class="n">io</span><span class="p">.</span><span
class="nb">why</span> <span class="p">=</span> "<span
class="n">Cannot</span> <span class="n">divide</span> <span class="n">by</span>
0"<span class="p">;</span>
<span class="n">throw</span> <span class="n">io</span><span
class="p">;</span>
<span class="p">}</span>
@@ -459,7 +468,7 @@ import shared.</em>;</p>
<span class="n">default</span><span class="p">:</span>
<span class="n">var</span> <span class="n">io</span> <span
class="p">=</span> <span class="n">new</span> <span
class="n">InvalidOperation</span><span class="p">();</span>
- <span class="n">io</span><span class="p">.</span><span
class="n">what</span> <span class="p">=</span> <span class="n">work</span><span
class="p">.</span><span class="n">op</span><span class="p">;</span>
+ <span class="n">io</span><span class="p">.</span><span
class="n">whatOp</span> <span class="p">=</span> <span
class="n">work</span><span class="p">.</span><span class="n">op</span><span
class="p">;</span>
<span class="n">io</span><span class="p">.</span><span
class="nb">why</span> <span class="p">=</span> "<span
class="n">Unknown</span> <span class="n">operation</span>"<span
class="p">;</span>
<span class="n">throw</span> <span class="n">io</span><span
class="p">;</span>
<span class="p">}</span>
@@ -489,7 +498,7 @@ import shared.</em>;</p>
This snippet was generated by Apache Thrift's <strong>source tree
docs</strong>:
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/haxe/src/CalculatorHandler.hx;hb=HEAD"</a>tutorial/haxe/src/CalculatorHandler.hx</a>
</p></p>
-<h3 id="additional-information">Additional Information</h3>
+<h3 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h3>
<p>Similar to Thrift, Haxe supports different compiler targets. Depending on
the target, some features
may or may not be supported. For example, if you plan to use Flash or
JavaScript targets,
there is currently no way to pass command line arguments to the program.</p>
Modified: websites/staging/thrift/trunk/content/tutorial/hs.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/hs.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/hs.html Sat Sep 26 12:54:26
2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="haskell-tutorial">Haskell Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="haskell-tutorial">Haskell Tutorial<a class="headerlink"
href="#haskell-tutorial" title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,8 +101,20 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
-<h3 id="client">Client</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="n">import</span> <span
class="n">qualified</span> <span class="n">Calculator</span>
<span class="n">import</span> <span class="n">qualified</span> <span
class="n">Calculator_Client</span> <span class="n">as</span> <span
class="n">Client</span>
<span class="n">import</span> <span class="n">qualified</span> <span
class="n">SharedService_Client</span> <span class="n">as</span> <span
class="n">SClient</span>
@@ -153,7 +176,19 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/hs/HaskellClient.hs;hb=HEAD"</a>tutorial/hs/HaskellClient.hs</a>
</p>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="p">{</span><span
class="o">-</span><span class="err">#</span> <span class="n">LANGUAGE</span>
<span class="n">OverloadedStrings</span> <span class="err">#</span><span
class="o">-</span><span class="p">}</span>
<span class="n">import</span> <span class="n">qualified</span> <span
class="n">Calculator</span>
@@ -211,7 +246,7 @@
<span class="k">if</span> <span class="n">num2</span>
<span class="n">work</span> <span class="o">==</span> <span class="mi">0</span>
<span class="n">then</span>
<span class="k">throw</span> <span class="err">$</span>
<span class="n">InvalidOperation</span> <span
class="p">{</span>
- <span class="n">invalidOperation_what</span>
<span class="o">=</span> <span class="n">fromIntegral</span> <span
class="err">$</span> <span class="n">fromEnum</span> <span class="err">$</span>
<span class="n">op</span> <span class="n">work</span><span class="p">,</span>
+ <span
class="n">invalidOperation_whatOp</span> <span class="o">=</span> <span
class="n">fromIntegral</span> <span class="err">$</span> <span
class="n">fromEnum</span> <span class="err">$</span> <span class="n">op</span>
<span class="n">work</span><span class="p">,</span>
<span class="n">invalidOperation_why</span>
<span class="o">=</span> <span class="s">"Cannot divide by 0"</span>
<span class="p">}</span>
<span class="k">else</span>
@@ -244,7 +279,7 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/hs/HaskellServer.hs;hb=HEAD"</a>tutorial/hs/HaskellServer.hs</a>
</p>
-<h2 id="additional-information">Additional Information</h2>
+<h2 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h2>
</div>
<div class="container">
<hr>
Modified: websites/staging/thrift/trunk/content/tutorial/index.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/index.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/index.html Sat Sep 26
12:54:26 2015
@@ -74,15 +74,26 @@
<div class="container">
-<h2 id="apache-thrift-tutorial">Apache Thrift Tutorial</h2>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="apache-thrift-tutorial">Apache Thrift Tutorial<a class="headerlink"
href="#apache-thrift-tutorial" title="Permanent link">¶</a></h2>
<hr />
<ul>
<li>
-<h3 id="download-apache-thrift">Download Apache Thrift</h3>
+<h3 id="download-apache-thrift">Download Apache Thrift<a class="headerlink"
href="#download-apache-thrift" title="Permanent link">¶</a></h3>
<p>To get started, <a href="/download">download</a> a copy of Thrift.</p>
</li>
<li>
-<h3 id="build-and-install-the-apache-thrift-compiler-and-libraries">Build and
Install the Apache Thrift compiler and libraries</h3>
+<h3 id="build-and-install-the-apache-thrift-compiler-and-libraries">Build and
Install the Apache Thrift compiler and libraries<a class="headerlink"
href="#build-and-install-the-apache-thrift-compiler-and-libraries"
title="Permanent link">¶</a></h3>
<p>You will then need to build the Apache Thrift compiler and libraries.</p>
<div class="codehilite"><pre><span class="o">./</span><span
class="n">configure</span> <span class="o">&&</span> <span
class="n">make</span>
</pre></div>
@@ -92,11 +103,11 @@
See the <a href="/docs/BuildingFromSource">Building from source</a> guide for
any help with this step.</p>
</li>
<li>
-<h3 id="writing-a-thrift-file">Writing a .thrift file</h3>
+<h3 id="writing-a-thrift-file">Writing a .thrift file<a class="headerlink"
href="#writing-a-thrift-file" title="Permanent link">¶</a></h3>
<p>After the Thrift compiler is installed you will need to create a .thrift
file. This file is an <a href="/docs/idl">interface definition</a> made up of
<a href="/docs/types">thrift types</a> and Services. The services you define in
this file are implemented by the server and are called by any clients.</p>
</li>
<li>
-<h3 id="generate-thrift-file-to-source-code">Generate Thrift file to source
code</h3>
+<h3 id="generate-thrift-file-to-source-code">Generate Thrift file to source
code<a class="headerlink" href="#generate-thrift-file-to-source-code"
title="Permanent link">¶</a></h3>
<p>The Thrift compiler is used to generate your Thrift file into source code
which is used by the different client libraries and the server you write. To
generate the source from a Thrift file run</p>
<div class="codehilite"><pre><span class="n">thrift</span> <span
class="o">--</span><span class="n">gen</span> <span class="o"><</span><span
class="n">language</span><span class="o">></span> <span
class="o"><</span><span class="n">Thrift</span> <span
class="n">filename</span><span class="o">></span>
</pre></div>
@@ -113,7 +124,18 @@ file defines a basic calculator service.
Both files will be used to demonstrate how to build a Thrift client and server
pair. </p>
</li>
</ul>
-<h2 id="examples-clients-and-servers">Examples Clients and Servers</h2>
+<h2 id="examples-clients-and-servers">Examples Clients and Servers<a
class="headerlink" href="#examples-clients-and-servers" title="Permanent
link">¶</a></h2>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
<ul>
<li><a href="/tutorial/as3">Actionscript 3.0</a></li>
<li><a href="/tutorial/c_glib">c_glib</a></li>
Modified: websites/staging/thrift/trunk/content/tutorial/java.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/java.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/java.html Sat Sep 26
12:54:26 2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="java-tutorial">Java Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="java-tutorial">Java Tutorial<a class="headerlink"
href="#java-tutorial" title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,8 +101,20 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
-<h3 id="client">Client</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="kn">import</span> <span
class="nn">tutorial.*</span><span class="o">;</span>
<span class="kn">import</span> <span class="nn">shared.*</span><span
class="o">;</span>
@@ -185,7 +208,19 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/java/src/JavaClient.java;hb=HEAD"</a>tutorial/java/src/JavaClient.java</a>
</p>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+
<div class="codehilite"><pre><span class="kn">import</span> <span
class="nn">org.apache.thrift.server.TServer</span><span class="o">;</span>
<span class="kn">import</span> <span
class="nn">org.apache.thrift.server.TServer.Args</span><span class="o">;</span>
<span class="kn">import</span> <span
class="nn">org.apache.thrift.server.TSimpleServer</span><span class="o">;</span>
@@ -284,7 +319,7 @@
<a
href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=tutorial/java/src/JavaServer.java;hb=HEAD"</a>tutorial/java/src/JavaServer.java</a>
</p>
-<h2 id="additional-information">Additional Information</h2>
+<h2 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h2>
</div>
<div class="container">
<hr>
Modified: websites/staging/thrift/trunk/content/tutorial/js.html
==============================================================================
--- websites/staging/thrift/trunk/content/tutorial/js.html (original)
+++ websites/staging/thrift/trunk/content/tutorial/js.html Sat Sep 26 12:54:26
2015
@@ -73,9 +73,20 @@
</div>
<div class="container">
- <h2 id="javascript-tutorial">Javascript Tutorial</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="javascript-tutorial">Javascript Tutorial<a class="headerlink"
href="#javascript-tutorial" title="Permanent link">¶</a></h2>
<hr />
-<h3 id="introduction">Introduction</h3>
+<h3 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h3>
<p>All Apache Thrift tutorials require that you have:</p>
<ol>
<li>Built and installed the Apache Thrift Compiler and Libraries, see <a
href="/docs/BuildingFromSource">Building from source</a> for more details.</li>
@@ -90,11 +101,11 @@
<p>Followed all prerequisites listed below.</p>
</li>
</ol>
-<h3 id="prerequisites">Prerequisites</h3>
+<h3 id="prerequisites">Prerequisites<a class="headerlink"
href="#prerequisites" title="Permanent link">¶</a></h3>
<ul>
<li>This tutorial depends on an existing Thrift server. See either the <a
href="/tutorial/java">Java tutorial</a> or <a href="/tutorial/nodejs">node.js
tutorial</a> for how to build and setup one of these servers. Out of the box, a
Thrift HTTP server using the JSON protocol is expected. To learn more about how
to use other transports and/or protocols refer to the "Additional Information"
section below.</li>
</ul>
-<h3 id="client">Client</h3>
+<h3 id="client">Client<a class="headerlink" href="#client" title="Permanent
link">¶</a></h3>
<pre><code class="language-js">
function calc() {
var transport = new Thrift.Transport("/thrift/service/tutorial/");
@@ -117,10 +128,10 @@ function calc() {
}
</code></pre>
-<h3 id="server">Server</h3>
+<h3 id="server">Server<a class="headerlink" href="#server" title="Permanent
link">¶</a></h3>
<p>Use either the <a href="/tutorial/java">Java tutorial</a> or <a
href="/tutorial/cpp">C++ tutorial</a> server </p>
-<h2 id="additional-information">Additional Information</h2>
-<h3 id="inspecting-the-generated-javascript-code-and-html-code">Inspecting the
generated Javascript code and HTML code</h3>
+<h2 id="additional-information">Additional Information<a class="headerlink"
href="#additional-information" title="Permanent link">¶</a></h2>
+<h3 id="inspecting-the-generated-javascript-code-and-html-code">Inspecting the
generated Javascript code and HTML code<a class="headerlink"
href="#inspecting-the-generated-javascript-code-and-html-code" title="Permanent
link">¶</a></h3>
<p>Inside the html file is the entry point of using the Thrift.js and compiled
Javascript files. The main section code from the tutorial.html file is the
Thrift client as shown above.</p>
<p>The first thing for using the Thrift files is setting up your Transport
protocol. At this time, it only supports AJAX and is as follows:</p>
<div class="codehilite"><pre><span class="n">var</span> <span
class="n">transport</span> <span class="p">=</span> <span class="n">new</span>
<span class="n">Thrift</span><span class="p">.</span><span
class="n">Transport</span><span class="p">(</span>"<span
class="o">/</span><span class="n">thrift</span><span class="o">/</span><span
class="n">service</span><span class="o">/</span><span
class="n">tutorial</span><span class="o">/</span>"<span class="p">);</span>
@@ -153,7 +164,7 @@ function calc() {
<p>Now, when the calculate button on the html page is clicked, the calc()
function as defined above is called and we get an AJAX call, which blocks and
waits for the response. This then updates the result from the calculation.</p>
-<h3 id="inspecting-the-generated-tutorial_typesjs-file">Inspecting the
generated tutorial_types.js file</h3>
+<h3 id="inspecting-the-generated-tutorial_typesjs-file">Inspecting the
generated tutorial_types.js file<a class="headerlink"
href="#inspecting-the-generated-tutorial_typesjs-file" title="Permanent
link">¶</a></h3>
<p>Each Thrift struct will have properties associated with it. For our
tutorial object, Work, this is as shown above. For example:</p>
<div class="codehilite"><pre><span class="n">var</span> <span
class="n">work</span> <span class="p">=</span> <span class="n">new</span> <span
class="n">Work</span><span class="p">();</span>
<span class="n">work</span><span class="p">.</span><span class="n">num1</span>
<span class="p">=</span> 1<span class="p">;</span>
@@ -163,7 +174,7 @@ function calc() {
<p>In addition, there is a read(input) and write(output) function created on
the object as well. For the end user, these are not functions to be used as
they are mainly just used by the Thrift.js file for accessing objects.</p>
-<h3 id="inspecting-the-generated-calculatorjs-file">Inspecting the generated
Calculator.js file</h3>
+<h3 id="inspecting-the-generated-calculatorjs-file">Inspecting the generated
Calculator.js file<a class="headerlink"
href="#inspecting-the-generated-calculatorjs-file" title="Permanent
link">¶</a></h3>
<p>The Calculator.js file is the services created and defined in the .thrift
file. The two services defined are:</p>
<div class="codehilite"><pre><span class="n">i32</span> <span
class="n">add</span><span class="p">(</span>1<span class="p">:</span><span
class="n">i32</span> <span class="n">num1</span><span class="p">,</span> 2<span
class="p">:</span><span class="n">i32</span> <span class="n">num2</span><span
class="p">),</span>
<span class="n">i32</span> <span class="n">calculate</span><span
class="p">(</span>1<span class="p">:</span><span class="n">i32</span> <span
class="n">logid</span><span class="p">,</span> 2<span class="p">:</span><span
class="n">Work</span> <span class="n">w</span><span class="p">)</span> <span
class="n">throws</span> <span class="p">(</span>1<span class="p">:</span><span
class="n">InvalidOperation</span> <span class="n">ouch</span><span
class="p">),</span>
@@ -186,7 +197,7 @@ function calc() {
<p>Unfortunately, the Javascript object isn't just called Calculator and there
are a lot of other functions defined as well, but how those are used are out of
the scope of this tutorial. </p>
-<h3 id="inspecting-the-thriftjs-file">Inspecting the Thrift.js file</h3>
+<h3 id="inspecting-the-thriftjs-file">Inspecting the Thrift.js file<a
class="headerlink" href="#inspecting-the-thriftjs-file" title="Permanent
link">¶</a></h3>
<ul>
<li>The main goal of the library is to define the Transport and Protocol
layers.</li>
<li>The Transport layer can use AJAX or WebSockets. </li>
@@ -194,7 +205,7 @@ function calc() {
<li>There are also the Thrift object types and call functions defined here as
well.</li>
<li>The Thrift.js library can use jQuery.js if provided.</li>
</ul>
-<h4 id="jquery-api">jQuery API</h4>
+<h4 id="jquery-api">jQuery API<a class="headerlink" href="#jquery-api"
title="Permanent link">¶</a></h4>
<p>jQuery aware JS source files can generated using the <em>jquery</em>
compiler option:</p>
<div class="codehilite"><pre><span class="n">thrift</span> <span
class="o">--</span><span class="n">gen</span> <span class="n">js</span><span
class="p">:</span><span class="n">jquery</span> <span
class="n">tutorial</span><span class="p">.</span><span class="n">thrift</span>
</pre></div>