You access data by using an LzDataset object and bind the data with an object by using the datapath attribute that all LZX objects inherits from the LzNode class. This section explains the LzDataSet class and the next section explains the datapath attribute.
The LzDataset class hierarchy is shown in Figure 8.1.
Table 8.1 lists the attributes defined in the LzDataset class.
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
acceptencodings | Tag and JS | boolean | read-only | |
Description. Indicates whether or not this LzDataset object accepts encoded responses. | ||||
cacheable | Tag and JS | boolean | false | read-only |
Description. Indicates if the OpenLaszlo Server will attemp to cache response. | ||||
getresponseheaders | Tag and JS | boolean | true | read-only |
Description. Indicates whether or not the server will encode and send the HTTP response headers along with the data. This attribute will not work in SOLO deployment | ||||
ondata | Tag only | script | ||
Description. Invoked when new data arrives. | ||||
onerror | Tag only | script | ||
Description. Invoked when an error occurs. | ||||
ontimeout | Tag only | script | ||
Description. Invoked when a request times out. | ||||
querystring | Tag and JS | string | read-only | |
Description. The query string of the request URL. | ||||
querytype | Tag only | string | read-write | |
Description. The method of the request. The value is either get or post. | ||||
queuerequests | Tag and JS | boolean | read-write | |
Description. Indicates whether or not the client should ensure each request is queued. | ||||
request | Tag and JS | boolean | false | read-write |
Description. Indicates if the dataset will make a request right after initialization. | ||||
secure | Tag and JS | boolean | false | read-write |
Description. Indicates if a secure connection should be used. | ||||
timeout | Tag and JS | number | read-write | |
Description. The nuber of seconds the dataset will wait for a response before it times out. | ||||
trimwhitespace | Tag and JS | boolean | true | read-only |
Description. Indicates whether white spaces in XML data will be trimeed. | ||||
type | Tag and JS | string | read-write | |
Description. A value of ‘http’ will make the dataset load its content form the URL specified by the src attribute, rather than as a static XML file to inline. |
The following are the methods added to the LzDataset class.
abort()
Aborts the request.
clearRequestHeaderParams()
Clears all request headers.
doRequest
Sends the request.
getAllResponseHeaders()
Returns an LzParam object containing name/value pairs of the response headers.
getErrorString()
Returns an error string, in any.
getLoadTime()
Returns the number of milliseconds it took to load the last request.
getParams()
Returns an LzParam object containing the request parameters.
getPointer()
Returns a datapointer referencing the root of the dataset.
getQueryString()
Returns the query string.
getRequestHeaderParams()
Returns an LzParam object containing the request headers.
getResponseHeaderParams()
Returns an LzParam object containing the response headers.
getResponseHeader(headerName)
Returns the value of the specified header.
getSrc()
Returns the src attribute of the dataset.
setHeader(headerName, headerValue)
Sets the specified header.
setProxyRequests(value)
Assigned the specified boolean that indicates whether or not the request will be proxied.
setQueryParam(name, value)
Adds the specified query parameter.
setQueryParams(object)
Adds the query parameters in the specified object.
setQueryString(queryString)
Sets the query string.
setQueryType(type)
Sets the request method. The value of type must be either “post” or “get”.
setRequest(value)
Indicates whether or not the dataset makes its request upon initialization.
setSrc(src)
Sets the src attribute.