BiTextLoader

This class is used to load a plain text document from the server or the file system (if the application is run locally).

This class extends BiAbstractLoader and therefore all methods and fields available for BiAbstractLoader are also available for BiTextLoader .

Constructor

new BiTextLoader ( )

Parameters

No parameters.

Properties

Name Type get set Descripton
error Boolean checked Whether any error occured when loading the file
loaded Boolean checked Whether the file has been loaded
loading Boolean checked Whether a file is currently being loaded
method String checked checked The HTTP method to use for the request
password String checked checked The password to use when authentication is needed to load the file
text String checked The text inside the file
uri BiUri checked checked 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 ADF path.
user String checked checked The user name to use when authentication is needed to load the file
xmlHttp BiXmlHttp checked The underlying BiXmlHttp that handles the communication.

Methods

Name Description
abort Stops the loading of the current file
load Does an HTTP GET to recieve the file
open Prepares the text loader so that data can be sent and recieved. After the loader has been opened you can use send to start the send/load. This is done automatically when using load and post.
post Does an HTTP POST to recieve the file. A BiXmlDocument 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 BiXmlHttp should be set.
send Starts the HTTP request and loads the result. If an argument is provided this is either a BiXmlDocument or a String. You can simulate a HTML form post by encoding the string as a application/x-www-form-urlencoded and by setting the Content-Type request header of the xmlHttp object.

Events

Name Type Bubbles Descripton
load BiEvent Fires when the file has been loaded

Static Methods

Name Description
load Loads a file synchronously from the given URI and returns the text content the file

Static Fields

None.

Remarks

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.

Method Details

abort

Stops the loading of the current file

Syntax

object.abort
 (
 
 )
 

Parameters

No arguments.

Return Type

void

load

Does an HTTP GET to recieve the file

Syntax

object.load
 (
 oUri
 )
 

Parameters

Name Type Optional Default Descripton
oUri BiUri The location of the file. If this is a string a new URI is created from that string relative to the ADF path.

Return Type

void

open

Prepares the text loader so that data can be sent and recieved. After the loader has been opened you can use send to start the send/load. This is done automatically when using load and post.

Syntax

object.open
 (
 sMethod,oUri
 [
 ,bAsync
 [
 ,sUser
 [
 ,sPassword
 ]
 
 ]
 
 ]
 
 )
 

Parameters

Name Type Optional Default Descripton
sMethod String The HTTP method used to send/load the data. For example GET and POST.
oUri BiUri The location of the file. If this is a string a new URI is created from that string relative to the ADF path.
bAsync Boolean checked Whether to load the text file asynchronously or synchronously
sUser String checked The user name to use for authentication. If empty no authentacation is used.
sPassword String checked The password to use for authentication. If empty no authentacation is used.

Return Type

void

post

Does an HTTP POST to recieve the file. A BiXmlDocument 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 BiXmlHttp should be set.

Syntax

object.post
 (
 oUri
 [
 ,oXmlDocument
 ]
 
 )
 

Parameters

Name Type Optional Default Descripton
oUri BiUri The location of the file. If this is a string a new URI is created from that string relative to the ADF path.
oXmlDocument BiXmlDocument checked An XML document containing the POST data

Return Type

void

send

Starts the HTTP request and loads the result. If an argument is provided this is either a BiXmlDocument or a String. You can simulate a HTML form post by encoding the string as a application/x-www-form-urlencoded and by setting the Content-Type request header of the xmlHttp object.

Syntax

object.send
 (
 oObject
 )
 

Parameters

Name Type Optional Default Descripton
oObject Object An XML document or a string containing the POST data

Return Type

void

Static Method Details

load

Loads a file synchronously from the given URI and returns the text content the file

Syntax

BiTextLoader
 .
 load
 (
 oUri
 )
 

Parameters

Name Type Optional Default Descripton
oUri BiUri The location of the file. If this is a string a new URI is created from that string relative to the ADF path.

Return Type

String