Class HttpAsynchRpc
Object
|
+--HttpAsynchRpc
- class
HttpAsynchRpc
Defined in eh.js
|
Constructor Summary |
HttpAsynchRpc(server, user, pwd)
This class encapsulates the XMLHttpRequestWrapper class and
provides an easier way of sending data to a server.
|
|
Method Summary |
void
|
asynchSend( responseIntf, method, path, data, headers)
This function encapsulates the creation of XMLHttpRequestWrapper
objects and makes it easier to send asynchronous data to a server.
|
void
|
close(abort)
|
void
|
reset()
Call this.close(true) and reset connection.
|
$rpcIdle
Object $rpcIdle
HttpAsynchRpc
HttpAsynchRpc(server, user, pwd)
This class encapsulates the XMLHttpRequestWrapper class and
provides an easier way of sending data to a server. You typically
create one instance of this class and use method asynchSend for
sending asynchronous messages to the server. The HttpAsynchRpc
class contains an internal queue for pending messages, thus you do
not have to wait for a response before sending the next message to
the server.
Error range 1050 - 1099
Parameters:
server - optional server name. Defaults to the origin server. Cross-domain scripting is by default disabled in all browsers. You can change your browser's security settings to allow cross-domain scripting. If your browser is Internet Explorer, it is in Internet Options > Security > Internet Zone > Custom Level > Miscellaneous > Access data sources across domains : enable
user - optional user name
pwd - optional user password
asynchSend
void asynchSend( responseIntf, method, path, data, headers)
This function encapsulates the creation of XMLHttpRequestWrapper
objects and makes it easier to send asynchronous data to a server. The
function makes sure that only one XMLHttpRequestWrapper object is
active at any time. Requests are automatically added to an internal
queue and sent later if an XMLHttpRequestWrapper object is currently
in progress.
.
responseIntf must have an onResponse(respData, status, e) method. This
method is called asynchronously when the server sends the response
data.
respData: 1) An XMLHttpRequestWrapper object if status = 200.
2) The data sent if status != 200.
status: HTTP response status code.
e: Exception if any, or undefined if no exception.
The optional user and password overrides any previously set user
and password.
Parameters:
responseIntf - the response interface object. See above.
method - must be a method supported by the server. Supported methods: GET, POST, HEAD, PUT, DELETE, OPTIONS etc
path - is the path to the server resource.
data - optional data to send.
headers - optional headers to send. This must be an object containing {header1:value1,{header2:value2}. Example: {"Content-Type":"application/x-www-form-urlencoded"}
Throws:- 1050: Illegal responseIntf (Program error)
- 1051: RPC closed (Program error)
- Exceptions thrown by the XMLHttpRequestWrapper object are sent to the onResponse callback.
close
void close(abort)
Parameters:
abort - (optional) terminates any pending requests if true.
reset
void reset()
Call this.close(true) and reset connection.
Documentation generated by
JSDoc on Tue Feb 14 15:31:34 2012