Modified: olingo/site/trunk/content/doc/javascript/apidoc/net.html URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/javascript/apidoc/net.html?rev=1672271&r1=1672270&r2=1672271&view=diff ============================================================================== --- olingo/site/trunk/content/doc/javascript/apidoc/net.html (original) +++ olingo/site/trunk/content/doc/javascript/apidoc/net.html Thu Apr 9 09:03:39 2015 @@ -62,7 +62,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line3">line 3</a> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line3">line 3</a> </li></ul></dd> @@ -185,7 +185,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line55">line 55</a> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line53">line 53</a> </li></ul></dd> @@ -276,7 +276,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line72">line 72</a> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line70">line 70</a> </li></ul></dd> @@ -415,7 +415,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line97">line 97</a> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line95">line 95</a> </li></ul></dd> @@ -465,6 +465,1854 @@ <dt> + <h4 class="name" id="isAbsoluteUrl"><span class="type-signature"><inner> </span>isAbsoluteUrl<span class="signature">(url)</span><span class="type-signature"> → {Boolean}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Checks whether the specified URL is an absolute URL. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>url</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">URL to check.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line53">line 53</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + true if the url is an absolute URL; false otherwise. +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Boolean</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> + <h4 class="name" id="isLocalUrl"><span class="type-signature"><inner> </span>isLocalUrl<span class="signature">(url)</span><span class="type-signature"> → {Boolean}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Checks whether the specified URL is local to the current context. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>url</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">URL to check.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line105">line 105</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + true if the url is a local URL; false otherwise. +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Boolean</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> + <h4 class="name" id="isLocalUrl"><span class="type-signature"><inner> </span>isLocalUrl<span class="signature">(url)</span><span class="type-signature"> → {Boolean}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Checks whether the specified URL is local to the current context. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>url</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">URL to check.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line63">line 63</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + true if the url is a local URL; false otherwise. +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Boolean</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> + <h4 class="name" id="readResponseHeaders"><span class="type-signature"><inner> </span>readResponseHeaders<span class="signature">(xhr, headers)</span><span class="type-signature"></span></h4> + + +</dt> +<dd> + + + <div class="description"> + Reads response headers into array. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>xhr</code></td> + + + <td class="type"> + + +<span class="param-type">XMLHttpRequest</span> + + + + </td> + + + + + + <td class="description last">HTTP request with response available.</td> + </tr> + + + + <tr> + + <td class="name"><code>headers</code></td> + + + <td class="type"> + + +<span class="param-type">Array</span> + + + + </td> + + + + + + <td class="description last">Target array to fill with name/value pairs.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line149">line 149</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + +</dd> + + + +<dt> + <h4 class="name" id="readResponseHeaders"><span class="type-signature"><inner> </span>readResponseHeaders<span class="signature">(inHeader, outHeader)</span><span class="type-signature"></span></h4> + + +</dt> +<dd> + + + <div class="description"> + Reads response headers into array. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>inHeader</code></td> + + + <td class="type"> + + +<span class="param-type">Object</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>outHeader</code></td> + + + <td class="type"> + + +<span class="param-type">Array</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line80">line 80</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + +</dd> + + + +<dt> + <h4 class="name" id="removeCallback"><span class="type-signature"><inner> </span>removeCallback<span class="signature">(name, tick)</span><span class="type-signature"></span></h4> + + +</dt> +<dd> + + + <div class="description"> + Removes a callback used for a JSONP request. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>name</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">Function name to remove.</td> + </tr> + + + + <tr> + + <td class="name"><code>tick</code></td> + + + <td class="type"> + + +<span class="param-type">Number</span> + + + + </td> + + + + + + <td class="description last">Tick count used on the callback.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line121">line 121</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + +</dd> + + + +<dt> + <h4 class="name" id="removeIFrame"><span class="type-signature"><inner> </span>removeIFrame<span class="signature">(iframe)</span><span class="type-signature"> → {Object}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Removes an iframe. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>iframe</code></td> + + + <td class="type"> + + +<span class="param-type">Object</span> + + + + </td> + + + + + + <td class="description last">The iframe to remove.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line136">line 136</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + Null value to be assigned to iframe reference. +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Object</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> + <h4 class="name" id="writeHtmlToIFrame"><span class="type-signature"><inner> </span>writeHtmlToIFrame<span class="signature">(iframe, html)</span><span class="type-signature"></span></h4> + + +</dt> +<dd> + + + <div class="description"> + Writes HTML to an IFRAME document. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>iframe</code></td> + + + <td class="type"> + + +<span class="param-type">HTMLElement</span> + + + + </td> + + + + + + <td class="description last">The IFRAME element to write to.</td> + </tr> + + + + <tr> + + <td class="name"><code>html</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">The HTML to write.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line165">line 165</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + +</dd> + + </dl> + + + + + +</article> + +</section> + + + + + + +<section> + +<header> + <h2> + odata/net + </h2> + +</header> + +<article> + <div class="container-overview"> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line20">line 20</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + </div> + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + <dl> + +<dt> + <h4 class="name" id="createIFrame"><span class="type-signature"><inner> </span>createIFrame<span class="signature">(url)</span><span class="type-signature"> → {HTMLElement}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Creates an IFRAME tag for loading the JSONP script + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>url</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">The source URL of the script</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line53">line 53</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + The IFRAME tag +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">HTMLElement</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> + <h4 class="name" id="createXmlHttpRequest"><span class="type-signature"><inner> </span>createXmlHttpRequest<span class="signature">()</span><span class="type-signature"> → {XmlHttpRequest}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Creates a XmlHttpRequest object. + </div> + + + + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line70">line 70</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + XmlHttpRequest object. +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">XmlHttpRequest</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> + <h4 class="name" id="isAbsoluteUrl"><span class="type-signature"><inner> </span>isAbsoluteUrl<span class="signature">(url)</span><span class="type-signature"> → {Boolean}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Checks whether the specified URL is an absolute URL. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>url</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">URL to check.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line95">line 95</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + true if the url is an absolute URL; false otherwise. +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Boolean</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> + <h4 class="name" id="isAbsoluteUrl"><span class="type-signature"><inner> </span>isAbsoluteUrl<span class="signature">(url)</span><span class="type-signature"> → {Boolean}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Checks whether the specified URL is an absolute URL. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>url</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">URL to check.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line53">line 53</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + true if the url is an absolute URL; false otherwise. +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Boolean</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> + <h4 class="name" id="isLocalUrl"><span class="type-signature"><inner> </span>isLocalUrl<span class="signature">(url)</span><span class="type-signature"> → {Boolean}</span></h4> + + +</dt> +<dd> + + + <div class="description"> + Checks whether the specified URL is local to the current context. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>url</code></td> + + + <td class="type"> + + +<span class="param-type">String</span> + + + + </td> + + + + + + <td class="description last">URL to check.</td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line105">line 105</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + <h5>Returns:</h5> + + +<div class="param-desc"> + true if the url is a local URL; false otherwise. +</div> + + + +<dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Boolean</span> + + + </dd> +</dl> + + + + +</dd> + + + +<dt> <h4 class="name" id="isLocalUrl"><span class="type-signature"><inner> </span>isLocalUrl<span class="signature">(url)</span><span class="type-signature"> → {Boolean}</span></h4> @@ -554,7 +2402,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line107">line 107</a> + <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line63">line 63</a> </li></ul></dd> @@ -716,7 +2564,147 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line151">line 151</a> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line149">line 149</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + +</dd> + + + +<dt> + <h4 class="name" id="readResponseHeaders"><span class="type-signature"><inner> </span>readResponseHeaders<span class="signature">(inHeader, outHeader)</span><span class="type-signature"></span></h4> + + +</dt> +<dd> + + + <div class="description"> + Reads response headers into array. + </div> + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>inHeader</code></td> + + + <td class="type"> + + +<span class="param-type">Object</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>outHeader</code></td> + + + <td class="type"> + + +<span class="param-type">Array</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line80">line 80</a> </li></ul></dd> @@ -856,7 +2844,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line123">line 123</a> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line121">line 121</a> </li></ul></dd> @@ -973,7 +2961,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line138">line 138</a> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line136">line 136</a> </li></ul></dd> @@ -1135,7 +3123,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="net.js.html">odata/net.js</a>, <a href="net.js.html#line167">line 167</a> + <a href="net-browser.js.html">odata/net-browser.js</a>, <a href="net-browser.js.html#line165">line 165</a> </li></ul></dd> @@ -1176,13 +3164,13 @@ </div> <nav> - <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-datajs.html">datajs</a></li><li><a href="deferred.html">datajs/deferred</a></li><li><a href="utils.html">datajs/utils</a></li><li><a href="xml.html">datajs/xml</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils_.html">odata/utils</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h ref="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils.html">odata/utils</a></li><li><a href="deferred.html">odatajs/deferred</a></li><li><a href="utils_.html">odatajs/utils</a></li><li><a href="xml.html">odatajs/xml</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a href="DjsDeferred.html">DjsDeferred</a></li><l i><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> </nav> <br clear="both"> <footer> - Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Sep 15 2014 13:08:01 GMT+0200 (MESZ) + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Apr 09 2015 08:31:26 GMT+0200 (MESZ) </footer> <script> prettyPrint(); </script>
Modified: olingo/site/trunk/content/doc/javascript/apidoc/net.js.html URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/javascript/apidoc/net.js.html?rev=1672271&r1=1672270&r2=1672271&view=diff ============================================================================== --- olingo/site/trunk/content/doc/javascript/apidoc/net.js.html (original) +++ olingo/site/trunk/content/doc/javascript/apidoc/net.js.html Thu Apr 9 09:03:39 2015 @@ -25,345 +25,200 @@ <section> <article> - <pre class="prettyprint source"><code>/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** @module odata/net */ - - - -var utils = require('./../odatajs.js').utils; -// Imports. - -var defined = utils.defined; -var delay = utils.delay; - -var ticks = 0; - -/* Checks whether the specified request can be satisfied with a JSONP request. - * @param request - Request object to check. - * @returns {Boolean} true if the request can be satisfied; false otherwise. - - * Requests that 'degrade' without changing their meaning by going through JSONP - * are considered usable. - * - * We allow data to come in a different format, as the servers SHOULD honor the Accept - * request but may in practice return content with a different MIME type. - */ -function canUseJSONP(request) { - - if (request.method && request.method !== "GET") { - return false; - } - - return true; -} - -/** Creates an IFRAME tag for loading the JSONP script - * @param {String} url - The source URL of the script - * @returns {HTMLElement} The IFRAME tag - */ -function createIFrame(url) { - var iframe = window.document.createElement("IFRAME"); - iframe.style.display = "none"; - - var attributeEncodedUrl = url.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"); - var html = "<html><head><script type=\"text/javascript\" src=\"" + attributeEncodedUrl + "\"><\/script><\/head><body><\/body><\/html>"; - - var body = window.document.getElementsByTagName("BODY")[0]; - body.appendChild(iframe); - - writeHtmlToIFrame(iframe, html); - return iframe; -}; - -/** Creates a XmlHttpRequest object. - * @returns {XmlHttpRequest} XmlHttpRequest object. - */ -function createXmlHttpRequest() { - if (window.XMLHttpRequest) { - return new window.XMLHttpRequest(); - } - var exception; - if (window.ActiveXObject) { - try { - return new window.ActiveXObject("Msxml2.XMLHTTP.6.0"); - } catch (_) { - try { - return new window.ActiveXObject("Msxml2.XMLHTTP.3.0"); - } catch (e) { - exception = e; - } - } - } else { - exception = { message: "XMLHttpRequest not supported" }; - } - throw exception; -} - -/** Checks whether the specified URL is an absolute URL. - * @param {String} url - URL to check. - * @returns {Boolean} true if the url is an absolute URL; false otherwise. -*/ -function isAbsoluteUrl(url) { - return url.indexOf("http://") === 0 || - url.indexOf("https://") === 0 || - url.indexOf("file://") === 0; -} - -/** Checks whether the specified URL is local to the current context. - * @param {String} url - URL to check. - * @returns {Boolean} true if the url is a local URL; false otherwise. - */ -function isLocalUrl(url) { - - if (!isAbsoluteUrl(url)) { - return true; - } - - // URL-embedded username and password will not be recognized as same-origin URLs. - var location = window.location; - var locationDomain = location.protocol + "//" + location.host + "/"; - return (url.indexOf(locationDomain) === 0); -} - -/** Removes a callback used for a JSONP request. - * @param {String} name - Function name to remove. - * @param {Number} tick - Tick count used on the callback. - */ -function removeCallback(name, tick) { - try { - delete window[name]; - } catch (err) { - window[name] = undefined; - if (tick === ticks - 1) { - ticks -= 1; - } - } -}; - -/** Removes an iframe. - * @param {Object} iframe - The iframe to remove. - * @returns {Object} Null value to be assigned to iframe reference. - */ -function removeIFrame(iframe) { - if (iframe) { - writeHtmlToIFrame(iframe, ""); - iframe.parentNode.removeChild(iframe); - } - - return null; -}; - -/** Reads response headers into array. - * @param {XMLHttpRequest} xhr - HTTP request with response available. - * @param {Array} headers - Target array to fill with name/value pairs. - */ -function readResponseHeaders(xhr, headers) { - - var responseHeaders = xhr.getAllResponseHeaders().split(/\r?\n/); - var i, len; - for (i = 0, len = responseHeaders.length; i < len; i++) { - if (responseHeaders[i]) { - var header = responseHeaders[i].split(": "); - headers[header[0]] = header[1]; - } - } -} - -/** Writes HTML to an IFRAME document. - * @param {HTMLElement} iframe - The IFRAME element to write to. - * @param {String} html - The HTML to write. - */ -function writeHtmlToIFrame(iframe, html) { - var frameDocument = (iframe.contentWindow) ? iframe.contentWindow.document : iframe.contentDocument.document; - frameDocument.open(); - frameDocument.write(html); - frameDocument.close(); -} - -exports.defaultHttpClient = { - callbackParameterName: "$callback", - - formatQueryString: "$format=json", - - enableJsonpCallback: false, - - /** Performs a network request. - * @param {Object} request - Request description - * @param {Function} success - Success callback with the response object. - * @param {Function} error - Error callback with an error object. - * @returns {Object} Object with an 'abort' method for the operation. - */ - request: function (request, success, error) { - - var result = {}; - var xhr = null; - var done = false; - var iframe; - - result.abort = function () { - iframe = removeIFrame(iframe); - if (done) { - return; - } - - done = true; - if (xhr) { - xhr.abort(); - xhr = null; - } - - error({ message: "Request aborted" }); - }; - - var handleTimeout = function () { - iframe = removeIFrame(iframe); - if (!done) { - done = true; - xhr = null; - error({ message: "Request timed out" }); - } - }; - - var name; - var url = request.requestUri; - var enableJsonpCallback = defined(request.enableJsonpCallback, this.enableJsonpCallback); - var callbackParameterName = defined(request.callbackParameterName, this.callbackParameterName); - var formatQueryString = defined(request.formatQueryString, this.formatQueryString); - if (!enableJsonpCallback || isLocalUrl(url)) { - - xhr = createXmlHttpRequest(); - xhr.onreadystatechange = function () { - if (done || xhr === null || xhr.readyState !== 4) { - return; - } - - // Workaround for XHR behavior on IE. - var statusText = xhr.statusText; - var statusCode = xhr.status; - if (statusCode === 1223) { - statusCode = 204; - statusText = "No Content"; - } - - var headers = []; - readResponseHeaders(xhr, headers); - - var response = { requestUri: url, statusCode: statusCode, statusText: statusText, headers: headers, body: xhr.responseText }; - - done = true; - xhr = null; - if (statusCode >= 200 && statusCode <= 299) { - success(response); - } else { - error({ message: "HTTP request failed", request: request, response: response }); - } - }; - - xhr.open(request.method || "GET", url, true, request.user, request.password); - - // Set the name/value pairs. - if (request.headers) { - for (name in request.headers) { - xhr.setRequestHeader(name, request.headers[name]); - } - } - - // Set the timeout if available. - if (request.timeoutMS) { - xhr.timeout = request.timeoutMS; - xhr.ontimeout = handleTimeout; - } - - xhr.send(request.body); - } else { - if (!canUseJSONP(request)) { - throw { message: "Request is not local and cannot be done through JSONP." }; - } - - var tick = ticks; - ticks += 1; - var tickText = tick.toString(); - var succeeded = false; - var timeoutId; - name = "handleJSONP_" + tickText; - window[name] = function (data) { - iframe = removeIFrame(iframe); - if (!done) { - succeeded = true; - window.clearTimeout(timeoutId); - removeCallback(name, tick); - - // Workaround for IE8 and IE10 below where trying to access data.constructor after the IFRAME has been removed - // throws an "unknown exception" - if (window.ActiveXObject) { - data = window.JSON.parse(window.JSON.stringify(data)); - } - - - var headers; - if (!formatQueryString || formatQueryString == "$format=json") { - headers = { "Content-Type": "application/json;odata.metadata=minimal", "OData-Version": "4.0" }; - } else { - // the formatQueryString should be in the format of "$format=xxx", xxx should be one of the application/json;odata.metadata=minimal(none or full) - // set the content-type with the string xxx which stars from index 8. - headers = { "Content-Type": formatQueryString.substring(8), "OData-Version": "4.0" }; - } - - // Call the success callback in the context of the parent window, instead of the IFRAME - delay(function () { - removeIFrame(iframe); - success({ body: data, statusCode: 200, headers: headers }); - }); - } - }; - - // Default to two minutes before timing out, 1000 ms * 60 * 2 = 120000. - var timeoutMS = (request.timeoutMS) ? request.timeoutMS : 120000; - timeoutId = window.setTimeout(handleTimeout, timeoutMS); - - var queryStringParams = callbackParameterName + "=parent." + name; - if (formatQueryString) { - queryStringParams += "&" + formatQueryString; - } - - var qIndex = url.indexOf("?"); - if (qIndex === -1) { - url = url + "?" + queryStringParams; - } else if (qIndex === url.length - 1) { - url = url + queryStringParams; - } else { - url = url + "&" + queryStringParams; - } - - iframe = createIFrame(url); - } - - return result; - } -}; - - - -exports.canUseJSONP = canUseJSONP; -exports.isAbsoluteUrl = isAbsoluteUrl; + <pre class="prettyprint source"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +'use strict'; +/** @module odata/net */ + + +var http = require('http'); +var utils = require('./../utils.js'); +var url = require("url"); + + +var defined = utils.defined; +var delay = utils.delay; + +var ticks = 0; + +/* Checks whether the specified request can be satisfied with a JSONP request. + * @param request - Request object to check. + * @returns {Boolean} true if the request can be satisfied; false otherwise. + + * Requests that 'degrade' without changing their meaning by going through JSONP + * are considered usable. + * + * We allow data to come in a different format, as the servers SHOULD honor the Accept + * request but may in practice return content with a different MIME type. + */ +function canUseJSONP(request) { + return false; +} + + + +/** Checks whether the specified URL is an absolute URL. + * @param {String} url - URL to check. + * @returns {Boolean} true if the url is an absolute URL; false otherwise. +*/ +function isAbsoluteUrl(url) { + return url.indexOf("http://") === 0 || + url.indexOf("https://") === 0 || + url.indexOf("file://") === 0; +} + +/** Checks whether the specified URL is local to the current context. + * @param {String} url - URL to check. + * @returns {Boolean} true if the url is a local URL; false otherwise. + */ +function isLocalUrl(url) { + + if (!isAbsoluteUrl(url)) { + return true; + } + + // URL-embedded username and password will not be recognized as same-origin URLs. + var location = window.location; + var locationDomain = location.protocol + "//" + location.host + "/"; + return (url.indexOf(locationDomain) === 0); +} + + +/** Reads response headers into array. + * @param {Object} inHeader + * @param {Array} outHeader + */ +function readResponseHeaders(inHeader, outHeader) { + for (var property in inHeader) { + + if (inHeader.hasOwnProperty(property)) { + outHeader[property] = inHeader[property]; + } + } +} + + + + + +exports.defaultHttpClient = { + formatQueryString: "$format=json", + + + /** Performs a network request. + * @param {Object} request - Request description + * @param {Function} success - Success callback with the response object. + * @param {Function} error - Error callback with an error object. + * @returns {Object} Object with an 'abort' method for the operation. + */ + request: function (request, success, error) { + + var result = {}; + var done = false; + + var options = url.parse(request.requestUri); + options.method = request.method || "GET"; + options.headers = {}; + //options.auth = request.user + ':' + request.password; + //add headers + var name; + if (request.headers) { + for (name in request.headers) { + options.headers[name] = request.headers[name]; + } + } + + + var xhr = http.request(options); + + result.abort = function () { + if (done) { + return; + } + + done = true; + if (xhr) { + xhr.abort(); + xhr = null; + } + + error({ message: "Request aborted" }); + }; + + // Set the timeout if available. + if (request.timeoutMS) { + xhr.setTimeout(request.timeoutMS,function () { + if (!done) { + done = true; + xhr = null; + error({ message: "Request timed out" }); + } + }); + } + + xhr.on('error', function(e) { + var response = { requestUri: url, statusCode: 400, statusText: e.message }; + error({ message: "HTTP request failed", request: request, response: response }); + }); + + + xhr.on('response', function (resp) { + if (done || xhr === null) { + return; + } + + var headers = []; + readResponseHeaders(resp.headers, headers); + + var body = ''; + + resp.on('data', function(chunk) { + body+=chunk; + }); + resp.on('end', function() { + // do what you do + var response = { requestUri: url, statusCode: resp.statusCode, statusText: '', headers: headers, body: body }; + + done = true; + xhr = null; + if (resp.statusCode >= 200 && resp.statusCode <= 299) { + success(response); + } else { + error({ message: "HTTP request failed", request: request, response: response }); + } + }); + }); + + //xhr.open(request.method || "GET", url, true,); + if (request.body) { + xhr.write(request.body); + } + xhr.end(); + + return result; + } +}; + + + +exports.canUseJSONP = canUseJSONP; +exports.isAbsoluteUrl = isAbsoluteUrl; exports.isLocalUrl = isLocalUrl;</code></pre> </article> </section> @@ -374,13 +229,13 @@ exports.isLocalUrl = isLocalUrl;</code>< </div> <nav> - <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-datajs.html">datajs</a></li><li><a href="deferred.html">datajs/deferred</a></li><li><a href="utils.html">datajs/utils</a></li><li><a href="xml.html">datajs/xml</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils_.html">odata/utils</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h ref="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils.html">odata/utils</a></li><li><a href="deferred.html">odatajs/deferred</a></li><li><a href="utils_.html">odatajs/utils</a></li><li><a href="xml.html">odatajs/xml</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a href="DjsDeferred.html">DjsDeferred</a></li><l i><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> </nav> <br clear="both"> <footer> - Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Sep 15 2014 13:08:00 GMT+0200 (MESZ) + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Apr 09 2015 08:31:26 GMT+0200 (MESZ) </footer> <script> prettyPrint(); </script> Modified: olingo/site/trunk/content/doc/javascript/apidoc/odata.js.html URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/javascript/apidoc/odata.js.html?rev=1672271&r1=1672270&r2=1672271&view=diff ============================================================================== --- olingo/site/trunk/content/doc/javascript/apidoc/odata.js.html (original) +++ olingo/site/trunk/content/doc/javascript/apidoc/odata.js.html Thu Apr 9 09:03:39 2015 @@ -25,184 +25,187 @@ <section> <article> - <pre class="prettyprint source"><code>/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - /** @module odata */ - -// Imports -var odataUtils = exports.utils = require('./odata/utils.js'); -var odataHandler = exports.handler = require('./odata/handler.js'); -var odataMetadata = exports.metadata = require('./odata/metadata.js'); -var odataNet = exports.net = require('./odata/net.js'); -var odataJson = exports.json = require('./odata/json.js'); - exports.batch = require('./odata/batch.js'); - - - -var utils = require('./odatajs/utils.js'); -var assigned = utils.assigned; - -var defined = utils.defined; -var throwErrorCallback = utils.throwErrorCallback; - -var invokeRequest = odataUtils.invokeRequest; -var MAX_DATA_SERVICE_VERSION = odataHandler.MAX_DATA_SERVICE_VERSION; -var prepareRequest = odataUtils.prepareRequest; -var metadataParser = odataMetadata.metadataParser; - -// CONTENT START - -var handlers = [odataJson.jsonHandler, odataHandler.textHandler]; - -/** Dispatches an operation to handlers. - * @param {String} handlerMethod - Name of handler method to invoke. - * @param {Object} requestOrResponse - request/response argument for delegated call. - * @param {Object} context - context argument for delegated call. - */ -function dispatchHandler(handlerMethod, requestOrResponse, context) { - - var i, len; - for (i = 0, len = handlers.length; i < len && !handlers[i][handlerMethod](requestOrResponse, context); i++) { - } - - if (i === len) { - throw { message: "no handler for data" }; - } -} - -/** Default success handler for OData. - * @param data - Data to process. - */ -exports.defaultSuccess = function (data) { - - window.alert(window.JSON.stringify(data)); -}; - -exports.defaultError = throwErrorCallback; - -exports.defaultHandler = { - - /** Reads the body of the specified response by delegating to JSON handlers. - * @param response - Response object. - * @param context - Operation context. - */ - read: function (response, context) { - - if (response && assigned(response.body) && response.headers["Content-Type"]) { - dispatchHandler("read", response, context); - } - }, - - /** Write the body of the specified request by delegating to JSON handlers. - * @param request - Reques tobject. - * @param context - Operation context. - */ - write: function (request, context) { - - dispatchHandler("write", request, context); - }, - - maxDataServiceVersion: MAX_DATA_SERVICE_VERSION, - accept: "application/json;q=0.9, */*;q=0.1" - }; - -exports.defaultMetadata = []; //TODO check why is the defaultMetadata an Array? and not an Object. - -/** Reads data from the specified URL. - * @param urlOrRequest - URL to read data from. - * @param {Function} [success] - - * @param {Function} [error] - - * @param {Object} [handler] - - * @param {Object} [httpClient] - - * @param {Object} [metadata] - - */ -exports.read = function (urlOrRequest, success, error, handler, httpClient, metadata) { - - var request; - if (urlOrRequest instanceof String || typeof urlOrRequest === "string") { - request = { requestUri: urlOrRequest }; - } else { - request = urlOrRequest; - } - - return exports.request(request, success, error, handler, httpClient, metadata); -}; - -/** Sends a request containing OData payload to a server. - * @param {Object} request - Object that represents the request to be sent. - * @param {Function} [success] - - * @param {Function} [error] - - * @param {Object} [handler] - - * @param {Object} [httpClient] - - * @param {Object} [metadata] - - */ -exports.request = function (request, success, error, handler, httpClient, metadata) { - - success = success || exports.defaultSuccess; - error = error || exports.defaultError; - handler = handler || exports.defaultHandler; - httpClient = httpClient || odataNet.defaultHttpClient; - metadata = metadata || exports.defaultMetadata; - - // Augment the request with additional defaults. - request.recognizeDates = utils.defined(request.recognizeDates, odataJson.jsonHandler.recognizeDates); - request.callbackParameterName = utils.defined(request.callbackParameterName, odataNet.defaultHttpClient.callbackParameterName); - request.formatQueryString = utils.defined(request.formatQueryString, odataNet.defaultHttpClient.formatQueryString); - request.enableJsonpCallback = utils.defined(request.enableJsonpCallback, odataNet.defaultHttpClient.enableJsonpCallback); - - // Create the base context for read/write operations, also specifying complete settings. - var context = { - metadata: metadata, - recognizeDates: request.recognizeDates, - callbackParameterName: request.callbackParameterName, - formatQueryString: request.formatQueryString, - enableJsonpCallback: request.enableJsonpCallback - }; - - try { - odataUtils.prepareRequest(request, handler, context); - return odataUtils.invokeRequest(request, success, error, handler, httpClient, context); - } catch (err) { - // errors in success handler for sync requests are catched here and result in error handler calls. - // So here we fix this and throw that error further. - if (err.bIsSuccessHandlerError) { - throw err; - } else { - error(err); - } - } - -}; - -/** Parses the csdl metadata to DataJS metatdata format. This method can be used when the metadata is retrieved using something other than DataJS - * @param {string} csdlMetadata - A string that represents the entire csdl metadata. - * @returns {Object} An object that has the representation of the metadata in Datajs format. - */ -exports.parseMetadata = function (csdlMetadataDocument) { - - return metadataParser(null, csdlMetadataDocument); -}; - -// Configure the batch handler to use the default handler for the batch parts. -exports.batch.batchHandler.partHandler = exports.defaultHandler; -exports.metadataHandler = odataMetadata.metadataHandler;</code></pre> + <pre class="prettyprint source"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +'use strict'; + + /** @module odata */ + +// Imports +var odataUtils = exports.utils = require('./odata/odatautils.js'); +var odataHandler = exports.handler = require('./odata/handler.js'); +var odataMetadata = exports.metadata = require('./odata/metadata.js'); +var odataNet = exports.net = require('./odata/net.js'); +var odataJson = exports.json = require('./odata/json.js'); + exports.batch = require('./odata/batch.js'); + + + +var utils = require('./utils.js'); +var assigned = utils.assigned; + +var defined = utils.defined; +var throwErrorCallback = utils.throwErrorCallback; + +var invokeRequest = odataUtils.invokeRequest; +var MAX_DATA_SERVICE_VERSION = odataHandler.MAX_DATA_SERVICE_VERSION; +var prepareRequest = odataUtils.prepareRequest; +var metadataParser = odataMetadata.metadataParser; + +// CONTENT START + +var handlers = [odataJson.jsonHandler, odataHandler.textHandler]; + +/** Dispatches an operation to handlers. + * @param {String} handlerMethod - Name of handler method to invoke. + * @param {Object} requestOrResponse - request/response argument for delegated call. + * @param {Object} context - context argument for delegated call. + */ +function dispatchHandler(handlerMethod, requestOrResponse, context) { + + var i, len; + for (i = 0, len = handlers.length; i < len && !handlers[i][handlerMethod](requestOrResponse, context); i++) { + } + + if (i === len) { + throw { message: "no handler for data" }; + } +} + +/** Default success handler for OData. + * @param data - Data to process. + */ +exports.defaultSuccess = function (data) { + + window.alert(window.JSON.stringify(data)); +}; + +exports.defaultError = throwErrorCallback; + +exports.defaultHandler = { + + /** Reads the body of the specified response by delegating to JSON handlers. + * @param response - Response object. + * @param context - Operation context. + */ + read: function (response, context) { + + if (response && assigned(response.body) && response.headers["Content-Type"]) { + dispatchHandler("read", response, context); + } + }, + + /** Write the body of the specified request by delegating to JSON handlers. + * @param request - Reques tobject. + * @param context - Operation context. + */ + write: function (request, context) { + + dispatchHandler("write", request, context); + }, + + maxDataServiceVersion: MAX_DATA_SERVICE_VERSION, + accept: "application/json;q=0.9, */*;q=0.1" + }; + +exports.defaultMetadata = []; //TODO check why is the defaultMetadata an Array? and not an Object. + +/** Reads data from the specified URL. + * @param urlOrRequest - URL to read data from. + * @param {Function} [success] - + * @param {Function} [error] - + * @param {Object} [handler] - + * @param {Object} [httpClient] - + * @param {Object} [metadata] - + */ +exports.read = function (urlOrRequest, success, error, handler, httpClient, metadata) { + + var request; + if (urlOrRequest instanceof String || typeof urlOrRequest === "string") { + request = { requestUri: urlOrRequest }; + } else { + request = urlOrRequest; + } + + return exports.request(request, success, error, handler, httpClient, metadata); +}; + +/** Sends a request containing OData payload to a server. + * @param {Object} request - Object that represents the request to be sent. + * @param {Function} [success] - + * @param {Function} [error] - + * @param {Object} [handler] - + * @param {Object} [httpClient] - + * @param {Object} [metadata] - + */ +exports.request = function (request, success, error, handler, httpClient, metadata) { + + success = success || exports.defaultSuccess; + error = error || exports.defaultError; + handler = handler || exports.defaultHandler; + httpClient = httpClient || odataNet.defaultHttpClient; + metadata = metadata || exports.defaultMetadata; + + // Augment the request with additional defaults. + request.recognizeDates = utils.defined(request.recognizeDates, odataJson.jsonHandler.recognizeDates); + request.callbackParameterName = utils.defined(request.callbackParameterName, odataNet.defaultHttpClient.callbackParameterName); + request.formatQueryString = utils.defined(request.formatQueryString, odataNet.defaultHttpClient.formatQueryString); + request.enableJsonpCallback = utils.defined(request.enableJsonpCallback, odataNet.defaultHttpClient.enableJsonpCallback); + + // Create the base context for read/write operations, also specifying complete settings. + var context = { + metadata: metadata, + recognizeDates: request.recognizeDates, + callbackParameterName: request.callbackParameterName, + formatQueryString: request.formatQueryString, + enableJsonpCallback: request.enableJsonpCallback + }; + + try { + odataUtils.prepareRequest(request, handler, context); + return odataUtils.invokeRequest(request, success, error, handler, httpClient, context); + } catch (err) { + // errors in success handler for sync requests are catched here and result in error handler calls. + // So here we fix this and throw that error further. + if (err.bIsSuccessHandlerError) { + throw err; + } else { + error(err); + } + } + +}; + +/** Parses the csdl metadata to ODataJS metatdata format. This method can be used when the metadata is retrieved using something other than odatajs + * @param {string} csdlMetadataDocument - A string that represents the entire csdl metadata. + * @returns {Object} An object that has the representation of the metadata in odatajs format. + */ +exports.parseMetadata = function (csdlMetadataDocument) { + + return metadataParser(null, csdlMetadataDocument); +}; + +// Configure the batch handler to use the default handler for the batch parts. +exports.batch.batchHandler.partHandler = exports.defaultHandler; +exports.metadataHandler = odataMetadata.metadataHandler; +exports.jsonHandler = odataJson.jsonHandler; +</code></pre> </article> </section> @@ -212,13 +215,13 @@ exports.metadataHandler = odataMetadata </div> <nav> - <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-datajs.html">datajs</a></li><li><a href="deferred.html">datajs/deferred</a></li><li><a href="utils.html">datajs/utils</a></li><li><a href="xml.html">datajs/xml</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils_.html">odata/utils</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h ref="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils.html">odata/utils</a></li><li><a href="deferred.html">odatajs/deferred</a></li><li><a href="utils_.html">odatajs/utils</a></li><li><a href="xml.html">odatajs/xml</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a href="DjsDeferred.html">DjsDeferred</a></li><l i><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> </nav> <br clear="both"> <footer> - Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Sep 15 2014 13:07:59 GMT+0200 (MESZ) + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Apr 09 2015 08:31:26 GMT+0200 (MESZ) </footer> <script> prettyPrint(); </script> Modified: olingo/site/trunk/content/doc/javascript/apidoc/source.html URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/javascript/apidoc/source.html?rev=1672271&r1=1672270&r2=1672271&view=diff ============================================================================== --- olingo/site/trunk/content/doc/javascript/apidoc/source.html (original) +++ olingo/site/trunk/content/doc/javascript/apidoc/source.html Thu Apr 9 09:03:39 2015 @@ -62,7 +62,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line3">line 3</a> + <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line21">line 21</a> </li></ul></dd> @@ -266,7 +266,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line35">line 35</a> + <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line36">line 36</a> </li></ul></dd> @@ -406,7 +406,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line45">line 45</a> + <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line46">line 46</a> </li></ul></dd> @@ -568,7 +568,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line63">line 63</a> + <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line64">line 64</a> </li></ul></dd> @@ -708,7 +708,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line80">line 80</a> + <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line81">line 81</a> </li></ul></dd> @@ -916,7 +916,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line102">line 102</a> + <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line103">line 103</a> </li></ul></dd> @@ -1210,13 +1210,13 @@ </div> <nav> - <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-datajs.html">datajs</a></li><li><a href="deferred.html">datajs/deferred</a></li><li><a href="utils.html">datajs/utils</a></li><li><a href="xml.html">datajs/xml</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils_.html">odata/utils</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h ref="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils.html">odata/utils</a></li><li><a href="deferred.html">odatajs/deferred</a></li><li><a href="utils_.html">odatajs/utils</a></li><li><a href="xml.html">odatajs/xml</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a href="DjsDeferred.html">DjsDeferred</a></li><l i><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> </nav> <br clear="both"> <footer> - Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Sep 15 2014 13:08:00 GMT+0200 (MESZ) + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Apr 09 2015 08:31:26 GMT+0200 (MESZ) </footer> <script> prettyPrint(); </script>
