root / trunk / web / dojo / dojox / io / xhrWindowNamePlugin.js @ 12
History | View | Annotate | Download (1.2 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.io.xhrWindowNamePlugin"]){ |
||
9 | dojo._hasResource["dojox.io.xhrWindowNamePlugin"]=true; |
||
10 | dojo.provide("dojox.io.xhrWindowNamePlugin");
|
||
11 | dojo.require("dojox.io.xhrPlugins");
|
||
12 | dojo.require("dojox.io.windowName");
|
||
13 | dojo.require("dojox.io.httpParse");
|
||
14 | dojo.require("dojox.secure.capability");
|
||
15 | dojox.io.xhrWindowNamePlugin=function(_1,_2,_3){ |
||
16 | dojox.io.xhrPlugins.register("windowName",function(_4,_5){ |
||
17 | return _5.sync!==true&&(_4=="GET"||_4=="POST"||_2)&&(_5.url.substring(0,_1.length)==_1); |
||
18 | },function(_6,_7,_8){
|
||
19 | var _9=dojox.io.windowName.send;
|
||
20 | var _a=_7.load;
|
||
21 | _7.load=undefined;
|
||
22 | var _b=(_2?_2(_9,true):_9)(_6,_7,_8); |
||
23 | _b.addCallback(function(_c){
|
||
24 | var _d=_b.ioArgs;
|
||
25 | _d.xhr={getResponseHeader:function(_e){ |
||
26 | return dojo.queryToObject(_d.hash.match(/[^#]*$/)[0])[_e]; |
||
27 | }}; |
||
28 | if(_d.handleAs=="json"){ |
||
29 | if(!_3){
|
||
30 | dojox.secure.capability.validate(_c,["Date"],{});
|
||
31 | } |
||
32 | return dojo.fromJson(_c);
|
||
33 | } |
||
34 | return dojo._contentHandlers[_d.handleAs||"text"]({responseText:_c}); |
||
35 | }); |
||
36 | _7.load=_a; |
||
37 | if(_a){
|
||
38 | _b.addCallback(_a); |
||
39 | } |
||
40 | return _b;
|
||
41 | }); |
||
42 | }; |
||
43 | } |