The LzDataset Class

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.

Figure 8.1. The class hierarchy of LzDataset


Table 8.1 lists the attributes defined in the LzDataset class.

Table 8.1. The attributes defined in the LzDataset class
NameUsageTypeDefaultAccessibility
acceptencodingsTag and JSboolean read-only
 Description. Indicates whether or not this LzDataset object accepts encoded responses.
cacheableTag and JSbooleanfalseread-only
 Description. Indicates if the OpenLaszlo Server will attemp to cache response.
getresponseheadersTag and JSbooleantrueread-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
ondataTag onlyscript  
 Description. Invoked when new data arrives.
onerrorTag onlyscript  
 Description. Invoked when an error occurs.
ontimeoutTag onlyscript  
 Description. Invoked when a request times out.
querystringTag and JSstring read-only
 Description. The query string of the request URL.
querytypeTag onlystring read-write
 Description. The method of the request. The value is either get or post.
queuerequestsTag and JSboolean read-write
 Description. Indicates whether or not the client should ensure each request is queued.
requestTag and JSbooleanfalseread-write
 Description. Indicates if the dataset will make a request right after initialization.
secureTag and JSbooleanfalseread-write
 Description. Indicates if a secure connection should be used.
timeoutTag and JSnumber read-write
 Description. The nuber of seconds the dataset will wait for a response before it times out.
trimwhitespaceTag and JSbooleantrueread-only
 Description. Indicates whether white spaces in XML data will be trimeed.
typeTag and JSstring 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset