Connection.js
上传用户:dawnssy
上传日期:2022-08-06
资源大小:9345k
文件大小:27k
源码类别:

JavaScript

开发平台:

JavaScript

  1. /*!  * Ext JS Library 3.1.0  * Copyright(c) 2006-2009 Ext JS, LLC  * licensing@extjs.com  * http://www.extjs.com/license  */ (function(){
  2.     var BEFOREREQUEST = "beforerequest",
  3.         REQUESTCOMPLETE = "requestcomplete",
  4.         REQUESTEXCEPTION = "requestexception",
  5.         UNDEFINED = undefined,
  6.         LOAD = 'load',
  7.         POST = 'POST',
  8.         GET = 'GET',
  9.         WINDOW = window;
  10.     
  11.     /**
  12.      * @class Ext.data.Connection
  13.      * @extends Ext.util.Observable
  14.      * <p>The class encapsulates a connection to the page's originating domain, allowing requests to be made
  15.      * either to a configured URL, or to a URL specified at request time.</p>
  16.      * <p>Requests made by this class are asynchronous, and will return immediately. No data from
  17.      * the server will be available to the statement immediately following the {@link #request} call.
  18.      * To process returned data, use a
  19.      * <a href="#request-option-success" ext:member="request-option-success" ext:cls="Ext.data.Connection">success callback</a>
  20.      * in the request options object,
  21.      * or an {@link #requestcomplete event listener}.</p>
  22.      * <p><h3>File Uploads</h3><a href="#request-option-isUpload" ext:member="request-option-isUpload" ext:cls="Ext.data.Connection">File uploads</a> are not performed using normal "Ajax" techniques, that
  23.      * is they are <b>not</b> performed using XMLHttpRequests. Instead the form is submitted in the standard
  24.      * manner with the DOM <tt>&lt;form></tt> element temporarily modified to have its
  25.      * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
  26.      * to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
  27.      * but removed after the return data has been gathered.</p>
  28.      * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
  29.      * server is using JSON to send the return object, then the
  30.      * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
  31.      * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
  32.      * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
  33.      * "&lt;" as "&amp;lt;", "&amp;" as "&amp;amp;" etc.</p>
  34.      * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
  35.      * is created containing a <tt>responseText</tt> property in order to conform to the
  36.      * requirements of event handlers and callbacks.</p>
  37.      * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
  38.      * and some server technologies (notably JEE) may require some custom processing in order to
  39.      * retrieve parameter names and parameter values from the packet content.</p>
  40.      * @constructor
  41.      * @param {Object} config a configuration object.
  42.      */
  43.     Ext.data.Connection = function(config){    
  44.         Ext.apply(this, config);
  45.         this.addEvents(
  46.             /**
  47.              * @event beforerequest
  48.              * Fires before a network request is made to retrieve a data object.
  49.              * @param {Connection} conn This Connection object.
  50.              * @param {Object} options The options config object passed to the {@link #request} method.
  51.              */
  52.             BEFOREREQUEST,
  53.             /**
  54.              * @event requestcomplete
  55.              * Fires if the request was successfully completed.
  56.              * @param {Connection} conn This Connection object.
  57.              * @param {Object} response The XHR object containing the response data.
  58.              * See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
  59.              * for details.
  60.              * @param {Object} options The options config object passed to the {@link #request} method.
  61.              */
  62.             REQUESTCOMPLETE,
  63.             /**
  64.              * @event requestexception
  65.              * Fires if an error HTTP status was returned from the server.
  66.              * See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Status Code Definitions</a>
  67.              * for details of HTTP status codes.
  68.              * @param {Connection} conn This Connection object.
  69.              * @param {Object} response The XHR object containing the response data.
  70.              * See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
  71.              * for details.
  72.              * @param {Object} options The options config object passed to the {@link #request} method.
  73.              */
  74.             REQUESTEXCEPTION
  75.         );
  76.         Ext.data.Connection.superclass.constructor.call(this);
  77.     };
  78.     Ext.extend(Ext.data.Connection, Ext.util.Observable, {
  79.         /**
  80.          * @cfg {String} url (Optional) <p>The default URL to be used for requests to the server. Defaults to undefined.</p>
  81.          * <p>The <code>url</code> config may be a function which <i>returns</i> the URL to use for the Ajax request. The scope
  82.          * (<code><b>this</b></code> reference) of the function is the <code>scope</code> option passed to the {@link #request} method.</p>
  83.          */
  84.         /**
  85.          * @cfg {Object} extraParams (Optional) An object containing properties which are used as
  86.          * extra parameters to each request made by this object. (defaults to undefined)
  87.          */
  88.         /**
  89.          * @cfg {Object} defaultHeaders (Optional) An object containing request headers which are added
  90.          *  to each request made by this object. (defaults to undefined)
  91.          */
  92.         /**
  93.          * @cfg {String} method (Optional) The default HTTP method to be used for requests.
  94.          * (defaults to undefined; if not set, but {@link #request} params are present, POST will be used;
  95.          * otherwise, GET will be used.)
  96.          */
  97.         /**
  98.          * @cfg {Number} timeout (Optional) The timeout in milliseconds to be used for requests. (defaults to 30000)
  99.          */
  100.         timeout : 30000,
  101.         /**
  102.          * @cfg {Boolean} autoAbort (Optional) Whether this request should abort any pending requests. (defaults to false)
  103.          * @type Boolean
  104.          */
  105.         autoAbort:false,
  106.     
  107.         /**
  108.          * @cfg {Boolean} disableCaching (Optional) True to add a unique cache-buster param to GET requests. (defaults to true)
  109.          * @type Boolean
  110.          */
  111.         disableCaching: true,
  112.         
  113.         /**
  114.          * @cfg {String} disableCachingParam (Optional) Change the parameter which is sent went disabling caching
  115.          * through a cache buster. Defaults to '_dc'
  116.          * @type String
  117.          */
  118.         disableCachingParam: '_dc',
  119.         
  120.         /**
  121.          * <p>Sends an HTTP request to a remote server.</p>
  122.          * <p><b>Important:</b> Ajax server requests are asynchronous, and this call will
  123.          * return before the response has been received. Process any returned data
  124.          * in a callback function.</p>
  125.          * <pre><code>
  126. Ext.Ajax.request({
  127.    url: 'ajax_demo/sample.json',
  128.    success: function(response, opts) {
  129.       var obj = Ext.decode(response.responseText);
  130.       console.dir(obj);
  131.    },
  132.    failure: function(response, opts) {
  133.       console.log('server-side failure with status code ' + response.status);
  134.    }
  135. });
  136.          * </code></pre>
  137.          * <p>To execute a callback function in the correct scope, use the <tt>scope</tt> option.</p>
  138.          * @param {Object} options An object which may contain the following properties:<ul>
  139.          * <li><b>url</b> : String/Function (Optional)<div class="sub-desc">The URL to
  140.          * which to send the request, or a function to call which returns a URL string. The scope of the
  141.          * function is specified by the <tt>scope</tt> option. Defaults to the configured
  142.          * <tt>{@link #url}</tt>.</div></li>
  143.          * <li><b>params</b> : Object/String/Function (Optional)<div class="sub-desc">
  144.          * An object containing properties which are used as parameters to the
  145.          * request, a url encoded string or a function to call to get either. The scope of the function
  146.          * is specified by the <tt>scope</tt> option.</div></li>
  147.          * <li><b>method</b> : String (Optional)<div class="sub-desc">The HTTP method to use
  148.          * for the request. Defaults to the configured method, or if no method was configured,
  149.          * "GET" if no parameters are being sent, and "POST" if parameters are being sent.  Note that
  150.          * the method name is case-sensitive and should be all caps.</div></li>
  151.          * <li><b>callback</b> : Function (Optional)<div class="sub-desc">The
  152.          * function to be called upon receipt of the HTTP response. The callback is
  153.          * called regardless of success or failure and is passed the following
  154.          * parameters:<ul>
  155.          * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
  156.          * <li><b>success</b> : Boolean<div class="sub-desc">True if the request succeeded.</div></li>
  157.          * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data. 
  158.          * See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about 
  159.          * accessing elements of the response.</div></li>
  160.          * </ul></div></li>
  161.          * <li><a id="request-option-success"></a><b>success</b> : Function (Optional)<div class="sub-desc">The function
  162.          * to be called upon success of the request. The callback is passed the following
  163.          * parameters:<ul>
  164.          * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
  165.          * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
  166.          * </ul></div></li>
  167.          * <li><b>failure</b> : Function (Optional)<div class="sub-desc">The function
  168.          * to be called upon failure of the request. The callback is passed the
  169.          * following parameters:<ul>
  170.          * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
  171.          * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
  172.          * </ul></div></li>
  173.          * <li><b>scope</b> : Object (Optional)<div class="sub-desc">The scope in
  174.          * which to execute the callbacks: The "this" object for the callback function. If the <tt>url</tt>, or <tt>params</tt> options were
  175.          * specified as functions from which to draw values, then this also serves as the scope for those function calls.
  176.          * Defaults to the browser window.</div></li>
  177.          * <li><b>timeout</b> : Number (Optional)<div class="sub-desc">The timeout in milliseconds to be used for this request. Defaults to 30 seconds.</div></li>
  178.          * <li><b>form</b> : Element/HTMLElement/String (Optional)<div class="sub-desc">The <tt>&lt;form&gt;</tt>
  179.          * Element or the id of the <tt>&lt;form&gt;</tt> to pull parameters from.</div></li>
  180.          * <li><a id="request-option-isUpload"></a><b>isUpload</b> : Boolean (Optional)<div class="sub-desc"><b>Only meaningful when used 
  181.          * with the <tt>form</tt> option</b>.
  182.          * <p>True if the form object is a file upload (will be set automatically if the form was
  183.          * configured with <b><tt>enctype</tt></b> "multipart/form-data").</p>
  184.          * <p>File uploads are not performed using normal "Ajax" techniques, that is they are <b>not</b>
  185.          * performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
  186.          * DOM <tt>&lt;form></tt> element temporarily modified to have its
  187.          * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
  188.          * to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
  189.          * but removed after the return data has been gathered.</p>
  190.          * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
  191.          * server is using JSON to send the return object, then the
  192.          * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
  193.          * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
  194.          * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
  195.          * is created containing a <tt>responseText</tt> property in order to conform to the
  196.          * requirements of event handlers and callbacks.</p>
  197.          * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
  198.          * and some server technologies (notably JEE) may require some custom processing in order to
  199.          * retrieve parameter names and parameter values from the packet content.</p>
  200.          * </div></li>
  201.          * <li><b>headers</b> : Object (Optional)<div class="sub-desc">Request
  202.          * headers to set for the request.</div></li>
  203.          * <li><b>xmlData</b> : Object (Optional)<div class="sub-desc">XML document
  204.          * to use for the post. Note: This will be used instead of params for the post
  205.          * data. Any params will be appended to the URL.</div></li>
  206.          * <li><b>jsonData</b> : Object/String (Optional)<div class="sub-desc">JSON
  207.          * data to use as the post. Note: This will be used instead of params for the post
  208.          * data. Any params will be appended to the URL.</div></li>
  209.          * <li><b>disableCaching</b> : Boolean (Optional)<div class="sub-desc">True
  210.          * to add a unique cache-buster param to GET requests.</div></li>
  211.          * </ul></p>
  212.          * <p>The options object may also contain any other property which might be needed to perform
  213.          * postprocessing in a callback because it is passed to callback functions.</p>
  214.          * @return {Number} transactionId The id of the server transaction. This may be used
  215.          * to cancel the request.
  216.          */
  217.         request : function(o){
  218.             var me = this;
  219.             if(me.fireEvent(BEFOREREQUEST, me, o)){
  220.                 if (o.el) {
  221.                     if(!Ext.isEmpty(o.indicatorText)){
  222.                         me.indicatorText = '<div class="loading-indicator">'+o.indicatorText+"</div>";
  223.                     }
  224.                     if(me.indicatorText) {
  225.                         Ext.getDom(o.el).innerHTML = me.indicatorText;                        
  226.                     }
  227.                     o.success = (Ext.isFunction(o.success) ? o.success : function(){}).createInterceptor(function(response) {
  228.                         Ext.getDom(o.el).innerHTML = response.responseText;
  229.                     });
  230.                 }
  231.                 
  232.                 var p = o.params,
  233.                     url = o.url || me.url,                
  234.                     method,
  235.                     cb = {success: me.handleResponse,
  236.                           failure: me.handleFailure,
  237.                           scope: me,
  238.                           argument: {options: o},
  239.                           timeout : o.timeout || me.timeout
  240.                     },
  241.                     form,                    
  242.                     serForm;                    
  243.                   
  244.                      
  245.                 if (Ext.isFunction(p)) {
  246.                     p = p.call(o.scope||WINDOW, o);
  247.                 }
  248.                                                            
  249.                 p = Ext.urlEncode(me.extraParams, Ext.isObject(p) ? Ext.urlEncode(p) : p);    
  250.                 
  251.                 if (Ext.isFunction(url)) {
  252.                     url = url.call(o.scope || WINDOW, o);
  253.                 }
  254.     
  255.                 if((form = Ext.getDom(o.form))){
  256.                     url = url || form.action;
  257.                      if(o.isUpload || /multipart/form-data/i.test(form.getAttribute("enctype"))) { 
  258.                          return me.doFormUpload.call(me, o, p, url);
  259.                      }
  260.                     serForm = Ext.lib.Ajax.serializeForm(form);                    
  261.                     p = p ? (p + '&' + serForm) : serForm;
  262.                 }
  263.                 
  264.                 method = o.method || me.method || ((p || o.xmlData || o.jsonData) ? POST : GET);
  265.                 
  266.                 if(method === GET && (me.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
  267.                     var dcp = o.disableCachingParam || me.disableCachingParam;
  268.                     url = Ext.urlAppend(url, dcp + '=' + (new Date().getTime()));
  269.                 }
  270.                 
  271.                 o.headers = Ext.apply(o.headers || {}, me.defaultHeaders || {});
  272.                 
  273.                 if(o.autoAbort === true || me.autoAbort) {
  274.                     me.abort();
  275.                 }
  276.                  
  277.                 if((method == GET || o.xmlData || o.jsonData) && p){
  278.                     url = Ext.urlAppend(url, p);  
  279.                     p = '';
  280.                 }
  281.                 return (me.transId = Ext.lib.Ajax.request(method, url, cb, p, o));
  282.             }else{                
  283.                 return o.callback ? o.callback.apply(o.scope, [o,UNDEFINED,UNDEFINED]) : null;
  284.             }
  285.         },
  286.     
  287.         /**
  288.          * Determine whether this object has a request outstanding.
  289.          * @param {Number} transactionId (Optional) defaults to the last transaction
  290.          * @return {Boolean} True if there is an outstanding request.
  291.          */
  292.         isLoading : function(transId){
  293.             return transId ? Ext.lib.Ajax.isCallInProgress(transId) : !! this.transId;            
  294.         },
  295.     
  296.         /**
  297.          * Aborts any outstanding request.
  298.          * @param {Number} transactionId (Optional) defaults to the last transaction
  299.          */
  300.         abort : function(transId){
  301.             if(transId || this.isLoading()){
  302.                 Ext.lib.Ajax.abort(transId || this.transId);
  303.             }
  304.         },
  305.         // private
  306.         handleResponse : function(response){
  307.             this.transId = false;
  308.             var options = response.argument.options;
  309.             response.argument = options ? options.argument : null;
  310.             this.fireEvent(REQUESTCOMPLETE, this, response, options);
  311.             if(options.success){
  312.                 options.success.call(options.scope, response, options);
  313.             }
  314.             if(options.callback){
  315.                 options.callback.call(options.scope, options, true, response);
  316.             }
  317.         },
  318.         // private
  319.         handleFailure : function(response, e){
  320.             this.transId = false;
  321.             var options = response.argument.options;
  322.             response.argument = options ? options.argument : null;
  323.             this.fireEvent(REQUESTEXCEPTION, this, response, options, e);
  324.             if(options.failure){
  325.                 options.failure.call(options.scope, response, options);
  326.             }
  327.             if(options.callback){
  328.                 options.callback.call(options.scope, options, false, response);
  329.             }
  330.         },
  331.         // private
  332.         doFormUpload : function(o, ps, url){
  333.             var id = Ext.id(),
  334.                 doc = document,
  335.                 frame = doc.createElement('iframe'),
  336.                 form = Ext.getDom(o.form),
  337.                 hiddens = [],
  338.                 hd,
  339.                 encoding = 'multipart/form-data',
  340.                 buf = {
  341.                     target: form.target,
  342.                     method: form.method,
  343.                     encoding: form.encoding,
  344.                     enctype: form.enctype,
  345.                     action: form.action
  346.                 };
  347.             Ext.fly(frame).set({
  348.                 id: id,
  349.                 name: id,
  350.                 cls: 'x-hidden',
  351.                 src: Ext.SSL_SECURE_URL // for IE
  352.             });
  353.             doc.body.appendChild(frame);
  354.             // This is required so that IE doesn't pop the response up in a new window.
  355.             if(Ext.isIE){
  356.                document.frames[id].name = id;
  357.             }
  358.             Ext.fly(form).set({
  359.                 target: id,
  360.                 method: POST,
  361.                 enctype: encoding,
  362.                 encoding: encoding,
  363.                 action: url || buf.action
  364.             });
  365.             // add dynamic params
  366.             Ext.iterate(Ext.urlDecode(ps, false), function(k, v){
  367.                 hd = doc.createElement('input');
  368.                 Ext.fly(hd).set({
  369.                     type: 'hidden',
  370.                     value: v,
  371.                     name: k
  372.                 });
  373.                 form.appendChild(hd);
  374.                 hiddens.push(hd);
  375.             });
  376.             function cb(){
  377.                 var me = this,
  378.                     // bogus response object
  379.                     r = {responseText : '',
  380.                          responseXML : null,
  381.                          argument : o.argument},
  382.                     doc,
  383.                     firstChild;
  384.                 try{
  385.                     doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document;
  386.                     if(doc){
  387.                         if(doc.body){
  388.                             if(/textarea/i.test((firstChild = doc.body.firstChild || {}).tagName)){ // json response wrapped in textarea
  389.                                 r.responseText = firstChild.value;
  390.                             }else{
  391.                                 r.responseText = doc.body.innerHTML;
  392.                             }
  393.                         }
  394.                         //in IE the document may still have a body even if returns XML.
  395.                         r.responseXML = doc.XMLDocument || doc;
  396.                     }
  397.                 }
  398.                 catch(e) {}
  399.                 Ext.EventManager.removeListener(frame, LOAD, cb, me);
  400.                 me.fireEvent(REQUESTCOMPLETE, me, r, o);
  401.                 function runCallback(fn, scope, args){
  402.                     if(Ext.isFunction(fn)){
  403.                         fn.apply(scope, args);
  404.                     }
  405.                 }
  406.                 runCallback(o.success, o.scope, [r, o]);
  407.                 runCallback(o.callback, o.scope, [o, true, r]);
  408.                 if(!me.debugUploads){
  409.                     setTimeout(function(){Ext.removeNode(frame);}, 100);
  410.                 }
  411.             }
  412.             Ext.EventManager.on(frame, LOAD, cb, this);
  413.             form.submit();
  414.             Ext.fly(form).set(buf);
  415.             Ext.each(hiddens, function(h) {
  416.                 Ext.removeNode(h);
  417.             });
  418.         }
  419.     });
  420. })();
  421. /**
  422.  * @class Ext.Ajax
  423.  * @extends Ext.data.Connection
  424.  * <p>The global Ajax request class that provides a simple way to make Ajax requests
  425.  * with maximum flexibility.</p>
  426.  * <p>Since Ext.Ajax is a singleton, you can set common properties/events for it once
  427.  * and override them at the request function level only if necessary.</p>
  428.  * <p>Common <b>Properties</b> you may want to set are:<div class="mdetail-params"><ul>
  429.  * <li><b><tt>{@link #method}</tt></b><p class="sub-desc"></p></li>
  430.  * <li><b><tt>{@link #extraParams}</tt></b><p class="sub-desc"></p></li>
  431.  * <li><b><tt>{@link #url}</tt></b><p class="sub-desc"></p></li>
  432.  * </ul></div>
  433.  * <pre><code>
  434. // Default headers to pass in every request
  435. Ext.Ajax.defaultHeaders = {
  436.     'Powered-By': 'Ext'
  437. };
  438.  * </code></pre> 
  439.  * </p>
  440.  * <p>Common <b>Events</b> you may want to set are:<div class="mdetail-params"><ul>
  441.  * <li><b><tt>{@link Ext.data.Connection#beforerequest beforerequest}</tt></b><p class="sub-desc"></p></li>
  442.  * <li><b><tt>{@link Ext.data.Connection#requestcomplete requestcomplete}</tt></b><p class="sub-desc"></p></li>
  443.  * <li><b><tt>{@link Ext.data.Connection#requestexception requestexception}</tt></b><p class="sub-desc"></p></li>
  444.  * </ul></div>
  445.  * <pre><code>
  446. // Example: show a spinner during all Ajax requests
  447. Ext.Ajax.on('beforerequest', this.showSpinner, this);
  448. Ext.Ajax.on('requestcomplete', this.hideSpinner, this);
  449. Ext.Ajax.on('requestexception', this.hideSpinner, this);
  450.  * </code></pre> 
  451.  * </p>
  452.  * <p>An example request:</p>
  453.  * <pre><code>
  454. // Basic request
  455. Ext.Ajax.{@link Ext.data.Connection#request request}({
  456.    url: 'foo.php',
  457.    success: someFn,
  458.    failure: otherFn,
  459.    headers: {
  460.        'my-header': 'foo'
  461.    },
  462.    params: { foo: 'bar' }
  463. });
  464. // Simple ajax form submission
  465. Ext.Ajax.{@link Ext.data.Connection#request request}({
  466.     form: 'some-form',
  467.     params: 'foo=bar'
  468. });
  469.  * </code></pre> 
  470.  * </p>
  471.  * @singleton
  472.  */
  473. Ext.Ajax = new Ext.data.Connection({
  474.     /**
  475.      * @cfg {String} url @hide
  476.      */
  477.     /**
  478.      * @cfg {Object} extraParams @hide
  479.      */
  480.     /**
  481.      * @cfg {Object} defaultHeaders @hide
  482.      */
  483.     /**
  484.      * @cfg {String} method (Optional) @hide
  485.      */
  486.     /**
  487.      * @cfg {Number} timeout (Optional) @hide
  488.      */
  489.     /**
  490.      * @cfg {Boolean} autoAbort (Optional) @hide
  491.      */
  492.     /**
  493.      * @cfg {Boolean} disableCaching (Optional) @hide
  494.      */
  495.     /**
  496.      * @property  disableCaching
  497.      * True to add a unique cache-buster param to GET requests. (defaults to true)
  498.      * @type Boolean
  499.      */
  500.     /**
  501.      * @property  url
  502.      * The default URL to be used for requests to the server. (defaults to undefined)
  503.      * If the server receives all requests through one URL, setting this once is easier than
  504.      * entering it on every request.
  505.      * @type String
  506.      */
  507.     /**
  508.      * @property  extraParams
  509.      * An object containing properties which are used as extra parameters to each request made
  510.      * by this object (defaults to undefined). Session information and other data that you need
  511.      * to pass with each request are commonly put here.
  512.      * @type Object
  513.      */
  514.     /**
  515.      * @property  defaultHeaders
  516.      * An object containing request headers which are added to each request made by this object
  517.      * (defaults to undefined).
  518.      * @type Object
  519.      */
  520.     /**
  521.      * @property  method
  522.      * The default HTTP method to be used for requests. Note that this is case-sensitive and
  523.      * should be all caps (defaults to undefined; if not set but params are present will use
  524.      * <tt>"POST"</tt>, otherwise will use <tt>"GET"</tt>.)
  525.      * @type String
  526.      */
  527.     /**
  528.      * @property  timeout
  529.      * The timeout in milliseconds to be used for requests. (defaults to 30000)
  530.      * @type Number
  531.      */
  532.     /**
  533.      * @property  autoAbort
  534.      * Whether a new request should abort any pending requests. (defaults to false)
  535.      * @type Boolean
  536.      */
  537.     autoAbort : false,
  538.     /**
  539.      * Serialize the passed form into a url encoded string
  540.      * @param {String/HTMLElement} form
  541.      * @return {String}
  542.      */
  543.     serializeForm : function(form){
  544.         return Ext.lib.Ajax.serializeForm(form);
  545.     }
  546. });