You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by bu...@apache.org on 2014/05/03 00:36:17 UTC

svn commit: r907833 - in /websites/staging/thrift/trunk/content: ./ lib/js.html sitemap.html

Author: buildbot
Date: Fri May  2 22:36:17 2014
New Revision: 907833

Log:
Staging update by buildbot for thrift

Added:
    websites/staging/thrift/trunk/content/lib/js.html
Modified:
    websites/staging/thrift/trunk/content/   (props changed)
    websites/staging/thrift/trunk/content/sitemap.html

Propchange: websites/staging/thrift/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri May  2 22:36:17 2014
@@ -1 +1 @@
-1592074
+1592077

Added: websites/staging/thrift/trunk/content/lib/js.html
==============================================================================
--- websites/staging/thrift/trunk/content/lib/js.html (added)
+++ websites/staging/thrift/trunk/content/lib/js.html Fri May  2 22:36:17 2014
@@ -0,0 +1,216 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+    <meta content="en-us" http-equiv="Content-Language" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+    <link href="/static/images/favicon.ico" rel="shortcut icon" />
+    <link href="/static/css/style.css" rel="stylesheet" type="text/css" />
+    <link href="/static/css/codehilite.css" rel="stylesheet" type="text/css" />
+    <link href="/static/css/bootstrap.css" media="screen, projection" rel="stylesheet" type="text/css" />
+
+    <script src="/static/js/jquery.min.js"></script>
+	  <script src="/static/js/bootstrap-dropdown.js"></script>
+    <script src="/static/js/bootstrap-tab.js"></script>
+	
+    <title>Apache Thrift - </title>
+  </head>
+  <body>
+  	<div class="navbar">
+	<div class="navbar-inner">
+		<div class="container">
+			<a class="brand" href="/">Apache Thrift &trade;</a>
+			<div class="nav-collapse">
+				<ul class="nav pull-right">
+					<li>
+						<a href="/download">Download</a>
+					</li>
+					<li>
+						<a href="/docs">Documentation</a>
+					</li>
+					<li>
+						<a href="/developers">Developers</a>
+					</li>
+					<li>
+						<a href="/lib">Libraries</a>
+					</li>
+					<li>
+						<a href="/tutorial">Tutorials</a>
+					</li>
+					<li>
+						<a href="/test">Test Suite</a>
+					</li>
+					<li>
+						<a href="/about">About</a>
+					</li>
+					<li class="dropdown">
+						<a href="#" class="dropdown-toggle" data-toggle="dropdown">
+							Apache <b class="caret"></b>
+						</a>
+						<ul class="dropdown-menu">
+							<li>
+								<a href="http://www.apache.org/" target="_blank">Apache Home</a>
+							</li>
+							<li>
+								<a href="http://www.apache.org/licenses/" target="_blank">Apache License v2.0</a>
+							</li>
+							<li>
+								<a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Donate</a>
+							</li>
+							<li>
+								<a href="http://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a>
+							</li>
+							<li>
+								<a href="http://www.apache.org/security/" target="_blank">Security</a>
+							</li>
+						</ul>
+					</li>
+				</ul>
+			</div>
+		</div>
+	</div>
+</div>
+
+  	<div class="container">
+          <h2 id="grunt-build">Grunt Build</h2>
+<p>This is the base directory for the Apache Thrift JavaScript
+library. This directory contains a Gruntfile.js and a
+package.json. Many of the build and test tools used here
+require a recent version of Node.js to be installed. To 
+install the support files for the Grunt build tool execute
+the command:
+   $ npm install
+This reads the package.json and pulls in the appropriate
+sources from the internet. To build the JavaScript branch
+of Apache Thrift execute the command:
+   $ grunt
+This runs the grunt build tool, linting all of the source 
+files, setting up and running the tests, concatenating and
+minifying the main libraries and generating the html 
+documentation.</p>
+<h2 id="tree">Tree</h2>
+<p>The following directories are present (some only after the
+grunt build):
+  /src  - The JavaScript Apache Thrift source
+  /doc  - HTML documentation
+  /dist - Distribution files (thrift.js and thrift.min.js)
+  /test - Various tests, this is a good place to look for
+          example code
+  /node_modules - Build support files installed by npm</p>
+<h2 id="example-javascript-client-and-server">Example JavaScript Client and Server</h2>
+<p>The listing below demonstrates a simple browser based JavaScript
+Thrift client and Node.js JavaScript server for the hello_svc 
+service. </p>
+<h3 id="hellothrift-service-idl">hello.thrift - Service IDL</h3>
+<h3 id="build-with-thrift-gen-js-gen-jsnode-hellothrift">build with: $ thrift -gen js -gen js:node hello.thrift</h3>
+<div class="codehilite"><pre><span class="n">service</span> <span class="n">hello_svc</span> <span class="p">{</span>
+  <span class="n">string</span> <span class="n">get_message</span><span class="p">(</span>1<span class="p">:</span> <span class="n">string</span> <span class="n">name</span><span class="p">)</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<h3 id="hellohtml-browser-client">hello.html - Browser Client</h3>
+<div class="codehilite"><pre><span class="cp">&lt;!DOCTYPE html&gt;</span>
+<span class="nt">&lt;html</span> <span class="na">lang=</span><span class="s">&quot;en&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;head&gt;</span>
+    <span class="nt">&lt;meta</span> <span class="na">charset=</span><span class="s">&quot;utf-8&quot;</span><span class="nt">&gt;</span>
+    <span class="nt">&lt;title&gt;</span>Hello Thrift<span class="nt">&lt;/title&gt;</span>
+  <span class="nt">&lt;/head&gt;</span>
+  <span class="nt">&lt;body&gt;</span>
+    Name: <span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">&quot;text&quot;</span> <span class="na">id=</span><span class="s">&quot;name_in&quot;</span><span class="nt">&gt;</span>
+    <span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">&quot;button&quot;</span> <span class="na">id=</span><span class="s">&quot;get_msg&quot;</span> <span class="na">value=</span><span class="s">&quot;Get Message&quot;</span> <span class="nt">&gt;</span>
+    <span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">&quot;output&quot;</span><span class="nt">&gt;&lt;/div&gt;</span>
+
+    <span class="nt">&lt;script</span> <span class="na">src=</span><span class="s">&quot;thrift.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
+    <span class="nt">&lt;script</span> <span class="na">src=</span><span class="s">&quot;gen-js/hello_svc.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
+    <span class="nt">&lt;script&gt;</span>
+      (function() {
+        var transport = new Thrift.TXHRTransport(&quot;/hello&quot;);
+        var protocol  = new Thrift.TJSONProtocol(transport);
+        var client    = new hello_svcClient(protocol);
+        var nameElement = document.getElementById(&quot;name_in&quot;);
+        var outputElement = document.getElementById(&quot;output&quot;);
+        document.getElementById(&quot;get_msg&quot;)
+          .addEventListener(&quot;click&quot;, function(){
+            client.get_message(nameElement.value, function(result) {
+              outputElement.innerHTML = result;
+            });
+          });
+      })();
+    <span class="nt">&lt;/script&gt;</span>
+  <span class="nt">&lt;/body&gt;</span>
+<span class="nt">&lt;/html&gt;</span>
+</pre></div>
+
+
+<h3 id="hellojs-node-server">hello.js - Node Server</h3>
+<div class="codehilite"><pre><span class="n">var</span> <span class="n">thrift</span> <span class="p">=</span> <span class="n">require</span><span class="p">(</span><span class="s">&#39;thrift&#39;</span><span class="p">);</span>
+<span class="n">var</span> <span class="n">hello_svc</span> <span class="p">=</span> <span class="n">require</span><span class="p">(</span><span class="s">&#39;./gen-nodejs/hello_svc.js&#39;</span><span class="p">);</span>
+
+<span class="n">var</span> <span class="n">hello_handler</span> <span class="p">=</span> <span class="p">{</span>
+  <span class="n">get_message</span><span class="p">:</span> <span class="k">function</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">result</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">var</span> <span class="n">msg</span> <span class="p">=</span> &quot;<span class="n">Hello</span> &quot; <span class="o">+</span> <span class="n">name</span> <span class="o">+</span> &quot;!&quot;<span class="p">;</span>
+    <span class="n">result</span><span class="p">(</span><span class="n">null</span><span class="p">,</span> <span class="n">msg</span><span class="p">);</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="n">var</span> <span class="n">hello_svc_opt</span> <span class="p">=</span> <span class="p">{</span>
+  <span class="n">transport</span><span class="p">:</span> <span class="n">thrift</span><span class="p">.</span><span class="n">TBufferedTransport</span><span class="p">,</span>
+  <span class="n">protocol</span><span class="p">:</span> <span class="n">thrift</span><span class="p">.</span><span class="n">TJSONProtocol</span><span class="p">,</span>
+  <span class="n">processor</span><span class="p">:</span> <span class="n">hello_svc</span><span class="p">,</span>
+  <span class="n">handler</span><span class="p">:</span> <span class="n">hello_handler</span>
+<span class="p">};</span>
+
+<span class="n">var</span> <span class="n">server_opt</span> <span class="p">=</span> <span class="p">{</span>
+  <span class="n">staticFilePath</span><span class="p">:</span> &quot;<span class="p">.</span>&quot;<span class="p">,</span>
+  <span class="n">services</span><span class="p">:</span> <span class="p">{</span>
+    &quot;<span class="o">/</span><span class="n">hello</span>&quot;<span class="p">:</span> <span class="n">hello_svc_opt</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="n">var</span> <span class="n">server</span> <span class="p">=</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">createWebServer</span><span class="p">(</span><span class="n">server_opt</span><span class="p">);</span>
+<span class="n">var</span> <span class="n">port</span> <span class="p">=</span> 9099<span class="p">;</span>
+<span class="n">server</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="n">port</span><span class="p">);</span>
+<span class="n">console</span><span class="p">.</span><span class="nb">log</span><span class="p">(</span>&quot;<span class="n">Http</span><span class="o">/</span><span class="n">Thrift</span> <span class="n">Server</span> <span class="n">running</span> <span class="n">on</span> <span class="n">port</span><span class="p">:</span> &quot; <span class="o">+</span> <span class="n">port</span><span class="p">);</span>
+</pre></div>
+
+
+<p><p class='snippet_footer'>
+  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=lib/js/README.md;hb=HEAD"</a>lib/js/README.md</a>
+</p></p>
+	</div>
+	<div class="container">
+	<hr>
+	<footer class="footer">
+		<div class="row">
+			<div class="span3">
+				<h3>Links</h3>
+				<ul class="unstyled">
+					<li><a href="/download">Download</a></li>
+					<li><a href="/developers">Developers</a></li>
+					<li><a href="/tutorial">Tutorials</a></li>
+			    </ul>
+				<ul class="unstyled">
+					<li><a href="/sitemap">Sitemap</a></li>
+				</ul>
+			</div>
+			<div class="span3">
+				<h3>Get Involved</h3>
+				<ul class="unstyled">
+					<li><a href="/mailing">Mailing Lists</a></li>
+					<li><a href="http://issues.apache.org/jira/browse/THRIFT">Issue Tracking</a></li>
+					<li><a href="/docs/HowToContribute">How To Contribute</a></li>
+				</ul>	
+			</div>
+			<div class="span6">
+				<a href="http://www.apache.org/"><img src="/static/images/favicon.ico" /></a> Copyright 2014 <a href="http://www.apache.org/">Apache Software Foundation</a>. Licensed under the <a href="http://www.apache.org/licenses/">Apache License v2.0</a>. Apache, Apache Thrift, and the Apache feather logo are trademarks of The Apache Software Foundation.
+			</div>
+		</div>
+		
+	</footer>
+</div>
+
+  </body>
+</html>

Modified: websites/staging/thrift/trunk/content/sitemap.html
==============================================================================
--- websites/staging/thrift/trunk/content/sitemap.html (original)
+++ websites/staging/thrift/trunk/content/sitemap.html Fri May  2 22:36:17 2014
@@ -107,6 +107,7 @@
 </li>
 <li><a href="/lib/"></a></li>
 <li><a href="/lib/cpp"></a></li>
+<li><a href="/lib/js"></a></li>
 <li><a href="/mailing">Mailing Lists</a></li>
 <li><a href="/test/">Test Readme</a><ul>
 <li><a href="/test/ThriftTest">ThriftTest</a></li>