summaryrefslogtreecommitdiff
path: root/js/dojo/dojox/wire/ml/JsonHandler.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/dojo/dojox/wire/ml/JsonHandler.js')
-rw-r--r--js/dojo/dojox/wire/ml/JsonHandler.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/js/dojo/dojox/wire/ml/JsonHandler.js b/js/dojo/dojox/wire/ml/JsonHandler.js
new file mode 100644
index 0000000..e9b2f48
--- /dev/null
+++ b/js/dojo/dojox/wire/ml/JsonHandler.js
@@ -0,0 +1,47 @@
+//>>built
+// wrapped by build app
+define("dojox/wire/ml/JsonHandler", ["dijit","dojo","dojox","dojo/require!dojox/wire/ml/RestHandler,dojox/wire/_base,dojox/wire/ml/util"], function(dijit,dojo,dojox){
+dojo.provide("dojox.wire.ml.JsonHandler");
+
+dojo.require("dojox.wire.ml.RestHandler");
+dojo.require("dojox.wire._base");
+dojo.require("dojox.wire.ml.util");
+
+
+dojo.declare("dojox.wire.ml.JsonHandler", dojox.wire.ml.RestHandler, {
+ // summary:
+ // A REST service handler for JSON
+ // description:
+ // This class provides JSON handling for a REST service.
+ contentType: "text/json",
+ handleAs: "json",
+ headers: {"Accept": "*/json"},
+
+ _getContent: function(/*String*/method, /*Array*/parameters){
+ // summary:
+ // Generate a request content
+ // description:
+ // If 'method' is "POST" or "PUT", the first parameter in
+ // 'parameter' is used to generate a JSON content.
+ // method:
+ // A method name
+ // parameters:
+ // An array of parameters
+ // returns:
+ // A request content
+ var content = null;
+ if(method == "POST" || method == "PUT"){
+ var p = (parameters ? parameters[0] : undefined);
+ if(p){
+ if(dojo.isString(p)){
+ content = p;
+ }else{
+ content = dojo.toJson(p);
+ }
+ }
+ }
+ return content; //String
+ }
+});
+
+});