pajax_library.js

Main JavaScript library for object remoting

Summary
Main JavaScript library for object remoting
JSON Serializer/deserializer methods
Takes care of the HTTP Connection and marshalling of calls
Returns a handle of the xmlhttp object for various browsers
Invoke the dispatcher synchronously
Invoke the dispatcher asynchronously
Performs a remote call asynchronously or synchronously.
Base class for asynchronous callback listener
Invoked before an asynchronous call takes place
Invoked after an asynchronous call takes place
Invoked in case of error

Functions

toJSON

Object.prototype.toJSON = function()

JSON Serializer/deserializer methods

PajaxConnection

Takes care of the HTTP Connection and marshalling of calls

Summary
Returns a handle of the xmlhttp object for various browsers
Invoke the dispatcher synchronously
Invoke the dispatcher asynchronously
Performs a remote call asynchronously or synchronously.

Functions

PajaxConnection

function PajaxConnection(url)

Parameters

urlUrl to dispatch the call to

getXmlhttp

PajaxConnection.prototype.getXmlhttp = function ()

Returns a handle of the xmlhttp object for various browsers

Returns

xmlhttp object or null if not able to instanciate it

sendSynch

PajaxConnection.prototype.sendSynch = function (request)

Invoke the dispatcher synchronously

Parameters

requestRequest object.  It will be serialized before the call is made

Returns

Deserialized object received from the call Null if call fails

sendAsynch

PajaxConnection.prototype.sendAsynch = function (request,
listener)

Invoke the dispatcher asynchronously

Parameters

requestRequest object.  It will be serialized before the call is made
listenerListener object.  The corresponding “on”+methodName method will be invoked on the listener object with the result of the call

Returns

trueCall succeded
falsCall failed

remoteCall

PajaxConnection.prototype.remoteCall = function (id,
className,
method,
params,
listener)

Performs a remote call asynchronously or synchronously.  Takes care of marshalling the paremeters.

Parameters

idInternal id of the object to be invoked
classNameClass name of the object to invoke
methodMethod to invoke
paramsArrays of parameters for this method
listenerListener object for this class.  If not present, the call is synchronous.  If present, the call is asynchronous and the method on<method> is invoked on the listener object with the result of the call passed as a parameter.

Returns

true/false if asynchronous Object returned for synchrous calls

PajaxListener

Base class for asynchronous callback listener

Summary
Invoked before an asynchronous call takes place
Invoked after an asynchronous call takes place
Invoked in case of error

Functions

PajaxListener

function PajaxListener()

onBeforeCall

PajaxListener.prototype.onBeforeCall = function()

Invoked before an asynchronous call takes place

onAfterCall

PajaxListener.prototype.onAfterCall = function()

Invoked after an asynchronous call takes place

onError

PajaxListener.prototype.onError = function()

Invoked in case of error

Object.prototype.toJSON = function()
JSON Serializer/deserializer methods
function PajaxConnection(url)
PajaxConnection.prototype.getXmlhttp = function ()
Returns a handle of the xmlhttp object for various browsers
PajaxConnection.prototype.sendSynch = function (request)
Invoke the dispatcher synchronously
PajaxConnection.prototype.sendAsynch = function (request,
listener)
Invoke the dispatcher asynchronously
PajaxConnection.prototype.remoteCall = function (id,
className,
method,
params,
listener)
Performs a remote call asynchronously or synchronously.
function PajaxListener()
PajaxListener.prototype.onBeforeCall = function()
Invoked before an asynchronous call takes place
PajaxListener.prototype.onAfterCall = function()
Invoked after an asynchronous call takes place
PajaxListener.prototype.onError = function()
Invoked in case of error