RPC Framework selection for atitit.js JavaScript
1 . DWR 1
2 . using ajaxrpc 1
2 . 2. Data Type mapping table 1
3 . Json-rpc Introduction and use of lightweight remote call protocol 2
3 . 1. 2.3. JavaScript Client Invocation Example 2
3 . 2. 2.4, Direct GET request to call 2
4 . Atiri 3
1.
DWR
DWR wants to pick out a method of its own , troublesome .
2.
using Ajaxrpc
When calling the RPC method, it is a synchronous call if no callback function is passed, or an asynchronous call if the callback function is Passed.
2.1.1.1.
Synchronous Invocation2.1.
Data Type mapping table
AJAXRPC supports basic data types, custom classes, and generics are not supported.
datetime
null
Javascript |
Java |
. Net |
Php |
Description |
Number |
short,short Span style= "font-family:helvetica; font-size:10.5pt; " > integer,int long,long float,float double,double |
short,int16 Span style= "font-family:helvetica; font-size:10.5pt; " > int,int32 long,int64 float double,double |
Integer Float Double |
There are no strict boundaries between numeric types and can be arbitrarily converted |
| boolean |
boolean,boolean |
boolean , bool |
|
|
| string |
string |
string,string |
string |
|
| date |
date | TD Style= "width:107.6000pt;" >
string |
date string" y-m-d\th:i:s "format, php needs extra processing |
| object |
hashmap,map |
hashtable , IDictionary |
|
|
| array |
arraylist,list |
arraylist , IList |
|
|
| null |
null | TD Style= "width:107.6000pt;" >
null |
|
Ajaxrpc do developers know the difference between static and instance methods?!!
Static methods always have a copy in memory, which means that memory is always consumed and cannot be freed, while static methods are not conducive to debugging
author :: ★ (attilax) >>> nickname : old Wow's Paw ( full name:: attilax akbar al rapanui Attilax Baroque Alpha rapa Nui ) kanji name: ayron, Email:[email protected]
reprint please indicate source: http://www.cnblogs.com/attilax/
3.Json-rpc
Introduction and use of lightweight remote call protocol
This project can help developers easily implement JSON-RPC remote calls with the Java programming language
The JSON-RPC protocol is very simple and transmits the data format to the server when initiating a remote invocation as Follows:
{ "method": "sayHello", "params": ["Hello json-rpc"], "id": 1}
3.1.
2.3. JavaScript Client Invocation Example
Example of jsonrpcjs-based JavaScript client invocation:
var RPC = New jsonrpc. JSONRPC (' Http://127.0.0.1:8080/index.json ');
Rpc.call (' getsystemproperties ', function(result) {
Alert (result);
});
3.2.
2.4, Direct GET request to call
No need for any client, just manually stitching parameters for remote invocation, the request URL is as Follows:
Http://127.0.0.1:8080/index.json?method=getsystemproperties&id=3325235235235¶ms=jtvijtvk
Parameter description:
Method: Methods Name
Params: call parameters, JSON array format [], the parameters need to be url-encoded before Base64 encoding
Id: Call identifier, Any value
4.
Atiri
RPC Framework selection for atitit.js JavaScript