📄 bitextloader.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--Generated using api.website.xsl version 2003-07-17--><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"><title>BiTextLoader</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript"> function showDerivedClasses() { var ul = document.getElementById("api-derived-classes"); var lis = ul.childNodes; var l = lis.length; for (var i = 1; i < l; i++) lis[i].style.display = ""; lis[0].style.display = "none"; } </script></head><body><h1 id="BiTextLoader">BiTextLoader</h1><p>This class is used to load a plain text document from the server or the file system (if the application is run locally).</p><p>This class extends <code><a href="BiEventTarget.html">BiEventTarget</a></code> and therefore all methods and fields available for <code><a href="BiEventTarget.html">BiEventTarget</a></code> are also available for <code>BiTextLoader</code>.</p><ul class="partial-class-tree"><li><code><a href="BiObject.html">BiObject</a></code><ul><li><code><a href="BiEventTarget.html">BiEventTarget</a></code><ul><li><code>BiTextLoader</code><ul id="api-derived-classes"><li><code><a href="BiXmlLoader.html">BiXmlLoader</a></code></li></ul></li></ul></li></ul></li></ul><h2>Constructor</h2><p><code> new BiTextLoader()</code></p><h3>Parameters</h3><p>No parameters.</p><h2>Properties</h2><table><thead><tr><td>Name</td><td>Type</td><td class="get-header">get</td><td class="set-header">set</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="async"></a><code>async</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>Whether to load the text file asynchronously</td></tr><tr><td><a name="error"></a><code>error</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Whether any error occured when loading the file</td></tr><tr><td><a name="loaded"></a><code>loaded</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Whether the file has been loaded</td></tr><tr><td><a name="loading"></a><code>loading</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Whether a file is currently being loaded</td></tr><tr><td><a name="method"></a><code>method</code></td><td><code class="type">String</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The HTTP method to use for the request</td></tr><tr><td><a name="password"></a><code>password</code></td><td><code class="type">String</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The password to use when authentication is needed to load the file</td></tr><tr><td><a name="text"></a><code>text</code></td><td><code class="type">String</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>The text inside the file</td></tr><tr><td><a name="uri"></a><code>uri</code></td><td><code class="type"> <code><a href="BiUri.html">BiUri</a></code> </code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The URI (location) of the file to load. If this is set to a string a new URI is created from that string relative to the <code><a href="BiApplication.html#adfPath">ADF path</a></code>.</td></tr><tr><td><a name="user"></a><code>user</code></td><td><code class="type">String</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The user name to use when authentication is needed to load the file</td></tr><tr><td><a name="xmlHttp"></a><code>xmlHttp</code></td><td><code class="type"> <code><a href="BiXmlHttp.html">BiXmlHttp</a></code> </code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>The underlying <code><a href="BiXmlHttp.html">BiXmlHttp</a></code> that handles the communication.</td></tr></tbody></table><h2>Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#abort">abort</a></code></td><td>Stops the loading of the current file</td></tr><tr><td><code><a href="#load">load</a></code></td><td>Does an HTTP GET to recieve the file</td></tr><tr><td><code><a href="#open">open</a></code></td><td>Prepares the text loader so that data can be sent and recieved. After the loader has been opened you can use <code><a href="#send">send</a></code> to start the send/load. This is done automatically when using <code><a href="#load">load</a></code> and <code><a href="#post">post</a></code>.</td></tr><tr><td><code><a href="#post">post</a></code></td><td>Does an HTTP POST to recieve the file. A<code><a href="BiXmlDocument.html">BiXmlDocument</a></code> can be sent to the server containing the data. The data sent can also be a string and in this case the content type of the underlying<code><a href="BiXmlHttp.html">BiXmlHttp</a></code> should be set.</td></tr><tr><td><code><a href="#send">send</a></code></td><td>Starts the HTTP request and loads the result. If an argument is provided this is either a<code><a href="BiXmlDocument.html">BiXmlDocument</a></code> or a <code>String</code>. You can simulate a HTML form post by encoding the string as a <code>application/x-www-form-urlencoded</code> and by setting the <code>Content-Type</code> request header of the <code><a href="#xmlHttp">xmlHttp</a></code> object.</td></tr></tbody></table><h2>Events</h2><table><thead><tr><td>Name</td><td>Type</td><td class="bubbles-header">Bubbles</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="load"></a><code>load</code></td><td><code class="type"> <code><a href="BiEvent.html">BiEvent</a></code> </code></td><td class="bubbles-column"></td><td>Fires when the file has been loaded</td></tr></tbody></table><h2>Static Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#load">load</a></code></td><td>Loads a file synchronously from the given URI and returns the text content the file</td></tr></tbody></table><h2>Static Fields</h2><p>None.</p><h2>Remarks</h2><p>Using syncronous loading freezes the web browser while the loading takes place. This should be prevented as much as possible and therefore asynchronous loading is preferred.</p><h2>Method Details</h2><h3><a name="abort"></a>abort</h3><p>Stops the loading of the current file</p><h4>Syntax</h4><pre class="method-syntax">object.abort()</pre><h4>Parameters</h4><p>No arguments.</p><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="load"></a>load</h3><p>Does an HTTP GET to recieve the file</p><h4>Syntax</h4><pre class="method-syntax">object.load(<span class="methodArgument">oUri</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oUri</code></td><td><code class="type"> <code><a href="BiUri.html">BiUri</a></code> </code></td><td class="optional-column"></td><td></td><td>The location of the file. If this is a string a new URI is created from that string relative to the <code><a href="BiApplication.html#adfPath">ADF path</a></code>.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="open"></a>open</h3><p>Prepares the text loader so that data can be sent and recieved. After the loader has been opened you can use <code><a href="#send">send</a></code> to start the send/load. This is done automatically when using <code><a href="#load">load</a></code> and <code><a href="#post">post</a></code>.</p><h4>Syntax</h4><pre class="method-syntax">object.open(<span class="methodArgument">sMethod</span>, <span class="methodArgument">oUri</span> [, <span class="methodArgument">bAsync</span> [, <span class="methodArgument">sUser</span> [, <span class="methodArgument">sPassword</span>]]])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sMethod</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>The HTTP method used to send/load the data. For example <code>GET</code> and <code>POST</code>.</td></tr><tr><td><code>oUri</code></td><td><code class="type"> <code><a href="BiUri.html">BiUri</a></code> </code></td><td class="optional-column"></td><td></td><td>The location of the file. If this is a string a new URI is created from that string relative to the <code><a href="BiApplication.html#adfPath">ADF path</a></code>.</td></tr><tr><td><code>bAsync</code></td><td><code class="type">Boolean</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>Whether to load the text file asynchronously or synchronously </td></tr><tr><td><code>sUser</code></td><td><code class="type">String</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>The user name to use for authentication. If empty no authentacation is used. </td></tr><tr><td><code>sPassword</code></td><td><code class="type">String</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>The password to use for authentication. If empty no authentacation is used. </td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="post"></a>post</h3><p>Does an HTTP POST to recieve the file. A<code><a href="BiXmlDocument.html">BiXmlDocument</a></code> can be sent to the server containing the data. The data sent can also be a string and in this case the content type of the underlying<code><a href="BiXmlHttp.html">BiXmlHttp</a></code> should be set.</p><h4>Syntax</h4><pre class="method-syntax">object.post(<span class="methodArgument">oUri</span> [, <span class="methodArgument">oXmlDocument</span>])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oUri</code></td><td><code class="type"> <code><a href="BiUri.html">BiUri</a></code> </code></td><td class="optional-column"></td><td></td><td>The location of the file. If this is a string a new URI is created from that string relative to the <code><a href="BiApplication.html#adfPath">ADF path</a></code>.</td></tr><tr><td><code>oXmlDocument</code></td><td><code class="type"> <code><a href="BiXmlDocument.html">BiXmlDocument</a></code> </code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>An XML document containing the POST data </td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="send"></a>send</h3><p>Starts the HTTP request and loads the result. If an argument is provided this is either a<code><a href="BiXmlDocument.html">BiXmlDocument</a></code> or a <code>String</code>. You can simulate a HTML form post by encoding the string as a <code>application/x-www-form-urlencoded</code> and by setting the <code>Content-Type</code> request header of the <code><a href="#xmlHttp">xmlHttp</a></code> object.</p><h4>Syntax</h4><pre class="method-syntax">object.send(<span class="methodArgument">oObject</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oObject</code></td><td><code class="type">Object</code></td><td class="optional-column"></td><td></td><td>An XML document or a string containing the POST data</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h2>Static Method Details</h2><h3><a name="load"></a>load</h3><p>Loads a file synchronously from the given URI and returns the text content the file</p><h4>Syntax</h4><pre class="method-syntax">BiTextLoader.load(<span class="methodArgument">oUri</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oUri</code></td><td><code class="type"> <code><a href="BiUri.html">BiUri</a></code> </code></td><td class="optional-column"></td><td></td><td>The location of the file. If this is a string a new URI is created from that string relative to the <code><a href="BiApplication.html#adfPath">ADF path</a></code>.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">String</code></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -