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 |
aborted | Boolean | ![]() | Whether the loader has aborted | |
method | String | ![]() | ![]() | The HTTP method to use for the request |
password | String | ![]() | ![]() | The password to use when authentication is needed to load the file |
text | String | ![]() | The text inside the file | |
uri | | ![]() | ![]() | 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 | ![]() | ![]() | The user name to use when authentication is needed to load the file |
xmlHttp | | ![]() | The underlying BiXmlHttp that handles the communication. |
Methods
| Name | Description |
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 | | 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
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 | | 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 | ![]() | Whether to load the text file asynchronously or synchronously | |
sUser | String | ![]() | The user name to use for authentication. If empty no authentacation is used. | |
sPassword | String | ![]() | 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 | | The location of the file. If this is a string a new URI is created from that string relative to the ADF path. | ||
oXmlDocument | | ![]() | 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 | | 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
