<BackendService>

BackendService: Class connecting to a REST webservice and handling success of failure of the service call.

Usage:

         <canvas>
			<dataset name="i18nDS" src="rest/application/i18n" type="http" request="true" proxied="false" />
			<BackendService name="i18n"
				successDatapath="i18nDS:/app/currentLocale">
				<handler name="ontrigger" args="obj">
					this.prepareParams(obj.collectValues());			
				</handler>		
				<method name="handleError">
					Debug.write('Error requesting application resource bundle (i18n)!');
				</method>
				<method name="handleSuccess">
					Debug.write('Resource bundle loaded');
					// If we are already logged in, we have to reload the data
					// containing I18N strings
					if (canvas.loggedIn) {
						canvas.services.listTasks.startRequest();	
						canvas.services.listProjects.startRequest();
						canvas.services.listUsers.startRequest();
					}
				</method>		
			</BackendService>                
         </canvas>
         @END


Attributes

IDLE (default: idle)
 
PROCESSING_RESPONSE (default: processing response)
 
REQUEST_STARTED (default: request started)
 
WAITING_FOR_CLEAR (default: idle)
 
_errorCount (default: 0)
 
_lastMessage
 
_lastRequestTime (default: null)
 
_requestCount (default: 0)
 
_xmlSerialized (default: no XML document received yet)
 
clearDelay (default: 2500)

How much time should we wait before removing the error message. Of course this value can be overriden in any instance

 
clearMessageDel (default: null)

If we display an error message in a form we fwant to be able to clear that message after a certain time. This is the delegate used for the timer

 
failureDatapath

The xpath singalling a request error

 
httpMethod (default: GET)

HTTP method: POST or GET

 
successDatapath

The xpath which has to match for a successful request

 
trigger (default: 0)

Used as an event sender by the ServiceConnectors connecting to this service

 

Methods

handleError ()
 
init ()
init method
 
prepareParams (values)
Turn the associative array returned by the form into params for an HTTP reqeust.
Parameters:
values (array) - An associative array containing the values passed to the service
 
setupTimer ()
set the timer which will call the clear() method after an error message has been displayed.
 
startRequest ()
Start the request to the REST webservice