Revision 1374
Added by Dietmar over 13 years ago
connection_core.js | ||
---|---|---|
26 | 26 |
YAHOO.util.Connect = |
27 | 27 |
{ |
28 | 28 |
/** |
29 |
* @description Array of MSFT ActiveX ids for XMLHttpRequest.
|
|
30 |
* @property _msxml_progid
|
|
31 |
* @private
|
|
32 |
* @static
|
|
33 |
* @type array
|
|
29 |
* @description Array of MSFT ActiveX ids for XMLHttpRequest. |
|
30 |
* @property _msxml_progid |
|
31 |
* @private |
|
32 |
* @static |
|
33 |
* @type array |
|
34 | 34 |
*/ |
35 | 35 |
_msxml_progid:[ |
36 | 36 |
'Microsoft.XMLHTTP', |
... | ... | |
39 | 39 |
], |
40 | 40 |
|
41 | 41 |
/** |
42 |
* @description Object literal of HTTP header(s)
|
|
43 |
* @property _http_header
|
|
44 |
* @private
|
|
45 |
* @static
|
|
46 |
* @type object
|
|
42 |
* @description Object literal of HTTP header(s) |
|
43 |
* @property _http_header |
|
44 |
* @private |
|
45 |
* @static |
|
46 |
* @type object |
|
47 | 47 |
*/ |
48 | 48 |
_http_headers:{}, |
49 | 49 |
|
50 | 50 |
/** |
51 |
* @description Determines if HTTP headers are set.
|
|
52 |
* @property _has_http_headers
|
|
53 |
* @private
|
|
54 |
* @static
|
|
55 |
* @type boolean
|
|
51 |
* @description Determines if HTTP headers are set. |
|
52 |
* @property _has_http_headers |
|
53 |
* @private |
|
54 |
* @static |
|
55 |
* @type boolean |
|
56 | 56 |
*/ |
57 | 57 |
_has_http_headers:false, |
58 | 58 |
|
59 | 59 |
/** |
60 |
* @description Determines if a default header of
|
|
60 |
* @description Determines if a default header of |
|
61 | 61 |
* Content-Type of 'application/x-www-form-urlencoded' |
62 | 62 |
* will be added to any client HTTP headers sent for POST |
63 | 63 |
* transactions. |
64 |
* @property _use_default_post_header
|
|
65 |
* @private
|
|
66 |
* @static
|
|
67 |
* @type boolean
|
|
64 |
* @property _use_default_post_header |
|
65 |
* @private |
|
66 |
* @static |
|
67 |
* @type boolean |
|
68 | 68 |
*/ |
69 | 69 |
_use_default_post_header:true, |
70 | 70 |
|
71 | 71 |
/** |
72 |
* @description The default header used for POST transactions.
|
|
73 |
* @property _default_post_header
|
|
74 |
* @private
|
|
75 |
* @static
|
|
76 |
* @type boolean
|
|
72 |
* @description The default header used for POST transactions. |
|
73 |
* @property _default_post_header |
|
74 |
* @private |
|
75 |
* @static |
|
76 |
* @type boolean |
|
77 | 77 |
*/ |
78 | 78 |
_default_post_header:'application/x-www-form-urlencoded; charset=UTF-8', |
79 | 79 |
|
80 | 80 |
/** |
81 |
* @description The default header used for transactions involving the
|
|
81 |
* @description The default header used for transactions involving the |
|
82 | 82 |
* use of HTML forms. |
83 |
* @property _default_form_header
|
|
84 |
* @private
|
|
85 |
* @static
|
|
86 |
* @type boolean
|
|
83 |
* @property _default_form_header |
|
84 |
* @private |
|
85 |
* @static |
|
86 |
* @type boolean |
|
87 | 87 |
*/ |
88 | 88 |
_default_form_header:'application/x-www-form-urlencoded', |
89 | 89 |
|
90 | 90 |
/** |
91 |
* @description Determines if a default header of
|
|
91 |
* @description Determines if a default header of |
|
92 | 92 |
* 'X-Requested-With: XMLHttpRequest' |
93 | 93 |
* will be added to each transaction. |
94 |
* @property _use_default_xhr_header
|
|
95 |
* @private
|
|
96 |
* @static
|
|
97 |
* @type boolean
|
|
94 |
* @property _use_default_xhr_header |
|
95 |
* @private |
|
96 |
* @static |
|
97 |
* @type boolean |
|
98 | 98 |
*/ |
99 | 99 |
_use_default_xhr_header:true, |
100 | 100 |
|
101 | 101 |
/** |
102 |
* @description The default header value for the label
|
|
102 |
* @description The default header value for the label |
|
103 | 103 |
* "X-Requested-With". This is sent with each |
104 | 104 |
* transaction, by default, to identify the |
105 | 105 |
* request as being made by YUI Connection Manager. |
106 |
* @property _default_xhr_header
|
|
107 |
* @private
|
|
108 |
* @static
|
|
109 |
* @type boolean
|
|
106 |
* @property _default_xhr_header |
|
107 |
* @private |
|
108 |
* @static |
|
109 |
* @type boolean |
|
110 | 110 |
*/ |
111 | 111 |
_default_xhr_header:'XMLHttpRequest', |
112 | 112 |
|
113 | 113 |
/** |
114 |
* @description Determines if custom, default headers
|
|
114 |
* @description Determines if custom, default headers |
|
115 | 115 |
* are set for each transaction. |
116 |
* @property _has_default_header
|
|
117 |
* @private
|
|
118 |
* @static
|
|
119 |
* @type boolean
|
|
116 |
* @property _has_default_header |
|
117 |
* @private |
|
118 |
* @static |
|
119 |
* @type boolean |
|
120 | 120 |
*/ |
121 | 121 |
_has_default_headers:true, |
122 | 122 |
|
123 | 123 |
/** |
124 |
* @description Determines if custom, default headers
|
|
124 |
* @description Determines if custom, default headers |
|
125 | 125 |
* are set for each transaction. |
126 |
* @property _has_default_header
|
|
127 |
* @private
|
|
128 |
* @static
|
|
129 |
* @type boolean
|
|
126 |
* @property _has_default_header |
|
127 |
* @private |
|
128 |
* @static |
|
129 |
* @type boolean |
|
130 | 130 |
*/ |
131 | 131 |
_default_headers:{}, |
132 | 132 |
|
133 | 133 |
/** |
134 |
* @description Collection of polling references to the polling mechanism in handleReadyState.
|
|
135 |
* @property _poll
|
|
136 |
* @private
|
|
137 |
* @static
|
|
138 |
* @type object
|
|
134 |
* @description Collection of polling references to the polling mechanism in handleReadyState. |
|
135 |
* @property _poll |
|
136 |
* @private |
|
137 |
* @static |
|
138 |
* @type object |
|
139 | 139 |
*/ |
140 | 140 |
_poll:{}, |
141 | 141 |
|
142 | 142 |
/** |
143 |
* @description Queue of timeout values for each transaction callback with a defined timeout value.
|
|
144 |
* @property _timeOut
|
|
145 |
* @private
|
|
146 |
* @static
|
|
147 |
* @type object
|
|
143 |
* @description Queue of timeout values for each transaction callback with a defined timeout value. |
|
144 |
* @property _timeOut |
|
145 |
* @private |
|
146 |
* @static |
|
147 |
* @type object |
|
148 | 148 |
*/ |
149 | 149 |
_timeOut:{}, |
150 | 150 |
|
151 | 151 |
/** |
152 |
* @description The polling frequency, in milliseconds, for HandleReadyState.
|
|
152 |
* @description The polling frequency, in milliseconds, for HandleReadyState. |
|
153 | 153 |
* when attempting to determine a transaction's XHR readyState. |
154 | 154 |
* The default is 50 milliseconds. |
155 |
* @property _polling_interval
|
|
156 |
* @private
|
|
157 |
* @static
|
|
158 |
* @type int
|
|
155 |
* @property _polling_interval |
|
156 |
* @private |
|
157 |
* @static |
|
158 |
* @type int |
|
159 | 159 |
*/ |
160 | 160 |
_polling_interval:50, |
161 | 161 |
|
162 | 162 |
/** |
163 |
* @description A transaction counter that increments the transaction id for each transaction.
|
|
164 |
* @property _transaction_id
|
|
165 |
* @private
|
|
166 |
* @static
|
|
167 |
* @type int
|
|
163 |
* @description A transaction counter that increments the transaction id for each transaction. |
|
164 |
* @property _transaction_id |
|
165 |
* @private |
|
166 |
* @static |
|
167 |
* @type int |
|
168 | 168 |
*/ |
169 | 169 |
_transaction_id:0, |
170 | 170 |
|
171 | 171 |
/** |
172 |
* @description Custom event that fires at the start of a transaction
|
|
173 |
* @property startEvent
|
|
174 |
* @private
|
|
175 |
* @static
|
|
176 |
* @type CustomEvent
|
|
172 |
* @description Custom event that fires at the start of a transaction |
|
173 |
* @property startEvent |
|
174 |
* @private |
|
175 |
* @static |
|
176 |
* @type CustomEvent |
|
177 | 177 |
*/ |
178 | 178 |
startEvent: new YAHOO.util.CustomEvent('start'), |
179 | 179 |
|
180 | 180 |
/** |
181 |
* @description Custom event that fires when a transaction response has completed.
|
|
182 |
* @property completeEvent
|
|
183 |
* @private
|
|
184 |
* @static
|
|
185 |
* @type CustomEvent
|
|
181 |
* @description Custom event that fires when a transaction response has completed. |
|
182 |
* @property completeEvent |
|
183 |
* @private |
|
184 |
* @static |
|
185 |
* @type CustomEvent |
|
186 | 186 |
*/ |
187 | 187 |
completeEvent: new YAHOO.util.CustomEvent('complete'), |
188 | 188 |
|
189 | 189 |
/** |
190 |
* @description Custom event that fires when handleTransactionResponse() determines a
|
|
190 |
* @description Custom event that fires when handleTransactionResponse() determines a |
|
191 | 191 |
* response in the HTTP 2xx range. |
192 |
* @property successEvent
|
|
193 |
* @private
|
|
194 |
* @static
|
|
195 |
* @type CustomEvent
|
|
192 |
* @property successEvent |
|
193 |
* @private |
|
194 |
* @static |
|
195 |
* @type CustomEvent |
|
196 | 196 |
*/ |
197 | 197 |
successEvent: new YAHOO.util.CustomEvent('success'), |
198 | 198 |
|
199 | 199 |
/** |
200 |
* @description Custom event that fires when handleTransactionResponse() determines a
|
|
200 |
* @description Custom event that fires when handleTransactionResponse() determines a |
|
201 | 201 |
* response in the HTTP 4xx/5xx range. |
202 |
* @property failureEvent
|
|
203 |
* @private
|
|
204 |
* @static
|
|
205 |
* @type CustomEvent
|
|
202 |
* @property failureEvent |
|
203 |
* @private |
|
204 |
* @static |
|
205 |
* @type CustomEvent |
|
206 | 206 |
*/ |
207 | 207 |
failureEvent: new YAHOO.util.CustomEvent('failure'), |
208 | 208 |
|
209 | 209 |
/** |
210 |
* @description Custom event that fires when a transaction is successfully aborted.
|
|
211 |
* @property abortEvent
|
|
212 |
* @private
|
|
213 |
* @static
|
|
214 |
* @type CustomEvent
|
|
210 |
* @description Custom event that fires when a transaction is successfully aborted. |
|
211 |
* @property abortEvent |
|
212 |
* @private |
|
213 |
* @static |
|
214 |
* @type CustomEvent |
|
215 | 215 |
*/ |
216 | 216 |
abortEvent: new YAHOO.util.CustomEvent('abort'), |
217 | 217 |
|
218 | 218 |
/** |
219 |
* @description A reference table that maps callback custom events members to its specific
|
|
219 |
* @description A reference table that maps callback custom events members to its specific |
|
220 | 220 |
* event name. |
221 |
* @property _customEvents
|
|
222 |
* @private
|
|
223 |
* @static
|
|
224 |
* @type object
|
|
221 |
* @property _customEvents |
|
222 |
* @private |
|
223 |
* @static |
|
224 |
* @type object |
|
225 | 225 |
*/ |
226 | 226 |
_customEvents: |
227 | 227 |
{ |
... | ... | |
234 | 234 |
}, |
235 | 235 |
|
236 | 236 |
/** |
237 |
* @description Member to add an ActiveX id to the existing xml_progid array.
|
|
237 |
* @description Member to add an ActiveX id to the existing xml_progid array. |
|
238 | 238 |
* In the event(unlikely) a new ActiveX id is introduced, it can be added |
239 | 239 |
* without internal code modifications. |
240 |
* @method setProgId
|
|
241 |
* @public
|
|
242 |
* @static
|
|
243 |
* @param {string} id The ActiveX id to be added to initialize the XHR object.
|
|
244 |
* @return void
|
|
240 |
* @method setProgId |
|
241 |
* @public |
|
242 |
* @static |
|
243 |
* @param {string} id The ActiveX id to be added to initialize the XHR object. |
|
244 |
* @return void |
|
245 | 245 |
*/ |
246 | 246 |
setProgId:function(id) |
247 | 247 |
{ |
... | ... | |
249 | 249 |
}, |
250 | 250 |
|
251 | 251 |
/** |
252 |
* @description Member to override the default POST header.
|
|
253 |
* @method setDefaultPostHeader
|
|
254 |
* @public
|
|
255 |
* @static
|
|
256 |
* @param {boolean} b Set and use default header - true or false .
|
|
257 |
* @return void
|
|
252 |
* @description Member to override the default POST header. |
|
253 |
* @method setDefaultPostHeader |
|
254 |
* @public |
|
255 |
* @static |
|
256 |
* @param {boolean} b Set and use default header - true or false . |
|
257 |
* @return void |
|
258 | 258 |
*/ |
259 | 259 |
setDefaultPostHeader:function(b) |
260 | 260 |
{ |
... | ... | |
267 | 267 |
}, |
268 | 268 |
|
269 | 269 |
/** |
270 |
* @description Member to override the default transaction header..
|
|
271 |
* @method setDefaultXhrHeader
|
|
272 |
* @public
|
|
273 |
* @static
|
|
274 |
* @param {boolean} b Set and use default header - true or false .
|
|
275 |
* @return void
|
|
270 |
* @description Member to override the default transaction header.. |
|
271 |
* @method setDefaultXhrHeader |
|
272 |
* @public |
|
273 |
* @static |
|
274 |
* @param {boolean} b Set and use default header - true or false . |
|
275 |
* @return void |
|
276 | 276 |
*/ |
277 | 277 |
setDefaultXhrHeader:function(b) |
278 | 278 |
{ |
... | ... | |
285 | 285 |
}, |
286 | 286 |
|
287 | 287 |
/** |
288 |
* @description Member to modify the default polling interval.
|
|
289 |
* @method setPollingInterval
|
|
290 |
* @public
|
|
291 |
* @static
|
|
292 |
* @param {int} i The polling interval in milliseconds.
|
|
293 |
* @return void
|
|
288 |
* @description Member to modify the default polling interval. |
|
289 |
* @method setPollingInterval |
|
290 |
* @public |
|
291 |
* @static |
|
292 |
* @param {int} i The polling interval in milliseconds. |
|
293 |
* @return void |
|
294 | 294 |
*/ |
295 | 295 |
setPollingInterval:function(i) |
296 | 296 |
{ |
... | ... | |
300 | 300 |
}, |
301 | 301 |
|
302 | 302 |
/** |
303 |
* @description Instantiates a XMLHttpRequest object and returns an object with two properties:
|
|
303 |
* @description Instantiates a XMLHttpRequest object and returns an object with two properties: |
|
304 | 304 |
* the XMLHttpRequest instance and the transaction id. |
305 |
* @method createXhrObject
|
|
306 |
* @private
|
|
307 |
* @static
|
|
308 |
* @param {int} transactionId Property containing the transaction id for this transaction.
|
|
309 |
* @return object
|
|
305 |
* @method createXhrObject |
|
306 |
* @private |
|
307 |
* @static |
|
308 |
* @param {int} transactionId Property containing the transaction id for this transaction. |
|
309 |
* @return object |
|
310 | 310 |
*/ |
311 | 311 |
createXhrObject:function(transactionId) |
312 | 312 |
{ |
... | ... | |
339 | 339 |
}, |
340 | 340 |
|
341 | 341 |
/** |
342 |
* @description This method is called by asyncRequest to create a
|
|
342 |
* @description This method is called by asyncRequest to create a |
|
343 | 343 |
* valid connection object for the transaction. It also passes a |
344 | 344 |
* transaction id and increments the transaction id counter. |
345 |
* @method getConnectionObject
|
|
346 |
* @private
|
|
347 |
* @static
|
|
348 |
* @return {object}
|
|
345 |
* @method getConnectionObject |
|
346 |
* @private |
|
347 |
* @static |
|
348 |
* @return {object} |
|
349 | 349 |
*/ |
350 | 350 |
getConnectionObject:function(t) |
351 | 351 |
{ |
... | ... | |
376 | 376 |
}, |
377 | 377 |
|
378 | 378 |
/** |
379 |
* @description Method for initiating an asynchronous request via the XHR object.
|
|
380 |
* @method asyncRequest
|
|
381 |
* @public
|
|
382 |
* @static
|
|
383 |
* @param {string} method HTTP transaction method
|
|
384 |
* @param {string} uri Fully qualified path of resource
|
|
385 |
* @param {callback} callback User-defined callback function or object
|
|
386 |
* @param {string} postData POST body
|
|
387 |
* @return {object} Returns the connection object
|
|
379 |
* @description Method for initiating an asynchronous request via the XHR object. |
|
380 |
* @method asyncRequest |
|
381 |
* @public |
|
382 |
* @static |
|
383 |
* @param {string} method HTTP transaction method |
|
384 |
* @param {string} uri Fully qualified path of resource |
|
385 |
* @param {callback} callback User-defined callback function or object |
|
386 |
* @param {string} postData POST body |
|
387 |
* @return {object} Returns the connection object |
|
388 | 388 |
*/ |
389 | 389 |
asyncRequest:function(method, uri, callback, postData) |
390 | 390 |
{ |
... | ... | |
485 | 485 |
}, |
486 | 486 |
|
487 | 487 |
/** |
488 |
* @description This method creates and subscribes custom events,
|
|
488 |
* @description This method creates and subscribes custom events, |
|
489 | 489 |
* specific to each transaction |
490 |
* @method initCustomEvents
|
|
491 |
* @private
|
|
492 |
* @static
|
|
493 |
* @param {object} o The connection object
|
|
494 |
* @param {callback} callback The user-defined callback object
|
|
495 |
* @return {void}
|
|
490 |
* @method initCustomEvents |
|
491 |
* @private |
|
492 |
* @static |
|
493 |
* @param {object} o The connection object |
|
494 |
* @param {callback} callback The user-defined callback object |
|
495 |
* @return {void} |
|
496 | 496 |
*/ |
497 | 497 |
initCustomEvents:function(o, callback) |
498 | 498 |
{ |
... | ... | |
511 | 511 |
}, |
512 | 512 |
|
513 | 513 |
/** |
514 |
* @description This method serves as a timer that polls the XHR object's readyState
|
|
514 |
* @description This method serves as a timer that polls the XHR object's readyState |
|
515 | 515 |
* property during a transaction, instead of binding a callback to the |
516 | 516 |
* onreadystatechange event. Upon readyState 4, handleTransactionResponse |
517 | 517 |
* will process the response, and the timer will be cleared. |
518 |
* @method handleReadyState
|
|
519 |
* @private
|
|
520 |
* @static
|
|
521 |
* @param {object} o The connection object
|
|
522 |
* @param {callback} callback The user-defined callback object
|
|
523 |
* @return {void}
|
|
518 |
* @method handleReadyState |
|
519 |
* @private |
|
520 |
* @static |
|
521 |
* @param {object} o The connection object |
|
522 |
* @param {callback} callback The user-defined callback object |
|
523 |
* @return {void} |
|
524 | 524 |
*/ |
525 | 525 |
|
526 | 526 |
handleReadyState:function(o, callback) |
... | ... | |
562 | 562 |
}, |
563 | 563 |
|
564 | 564 |
/** |
565 |
* @description This method attempts to interpret the server response and
|
|
565 |
* @description This method attempts to interpret the server response and |
|
566 | 566 |
* determine whether the transaction was successful, or if an error or |
567 | 567 |
* exception was encountered. |
568 |
* @method handleTransactionResponse
|
|
569 |
* @private
|
|
570 |
* @static
|
|
571 |
* @param {object} o The connection object
|
|
572 |
* @param {object} callback The user-defined callback object
|
|
573 |
* @param {boolean} isAbort Determines if the transaction was terminated via abort().
|
|
574 |
* @return {void}
|
|
568 |
* @method handleTransactionResponse |
|
569 |
* @private |
|
570 |
* @static |
|
571 |
* @param {object} o The connection object |
|
572 |
* @param {object} callback The user-defined callback object |
|
573 |
* @param {boolean} isAbort Determines if the transaction was terminated via abort(). |
|
574 |
* @return {void} |
|
575 | 575 |
*/ |
576 | 576 |
handleTransactionResponse:function(o, callback, isAbort) |
577 | 577 |
{ |
... | ... | |
676 | 676 |
}, |
677 | 677 |
|
678 | 678 |
/** |
679 |
* @description This method evaluates the server response, creates and returns the results via
|
|
679 |
* @description This method evaluates the server response, creates and returns the results via |
|
680 | 680 |
* its properties. Success and failure cases will differ in the response |
681 | 681 |
* object's property values. |
682 |
* @method createResponseObject
|
|
683 |
* @private
|
|
684 |
* @static
|
|
685 |
* @param {object} o The connection object
|
|
686 |
* @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
|
|
687 |
* @return {object}
|
|
682 |
* @method createResponseObject |
|
683 |
* @private |
|
684 |
* @static |
|
685 |
* @param {object} o The connection object |
|
686 |
* @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback |
|
687 |
* @return {object} |
|
688 | 688 |
*/ |
689 | 689 |
createResponseObject:function(o, callbackArg) |
690 | 690 |
{ |
... | ... | |
722 | 722 |
}, |
723 | 723 |
|
724 | 724 |
/** |
725 |
* @description If a transaction cannot be completed due to dropped or closed connections,
|
|
725 |
* @description If a transaction cannot be completed due to dropped or closed connections, |
|
726 | 726 |
* there may be not be enough information to build a full response object. |
727 | 727 |
* The failure callback will be fired and this specific condition can be identified |
728 | 728 |
* by a status property value of 0. |
729 | 729 |
* |
730 | 730 |
* If an abort was successful, the status property will report a value of -1. |
731 | 731 |
* |
732 |
* @method createExceptionObject
|
|
733 |
* @private
|
|
734 |
* @static
|
|
735 |
* @param {int} tId The Transaction Id
|
|
736 |
* @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
|
|
737 |
* @param {boolean} isAbort Determines if the exception case is caused by a transaction abort
|
|
738 |
* @return {object}
|
|
732 |
* @method createExceptionObject |
|
733 |
* @private |
|
734 |
* @static |
|
735 |
* @param {int} tId The Transaction Id |
|
736 |
* @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback |
|
737 |
* @param {boolean} isAbort Determines if the exception case is caused by a transaction abort |
|
738 |
* @return {object} |
|
739 | 739 |
*/ |
740 | 740 |
createExceptionObject:function(tId, callbackArg, isAbort) |
741 | 741 |
{ |
... | ... | |
763 | 763 |
}, |
764 | 764 |
|
765 | 765 |
/** |
766 |
* @description Method that initializes the custom HTTP headers for the each transaction.
|
|
767 |
* @method initHeader
|
|
768 |
* @public
|
|
769 |
* @static
|
|
770 |
* @param {string} label The HTTP header label
|
|
771 |
* @param {string} value The HTTP header value
|
|
772 |
* @param {string} isDefault Determines if the specific header is a default header
|
|
766 |
* @description Method that initializes the custom HTTP headers for the each transaction. |
|
767 |
* @method initHeader |
|
768 |
* @public |
|
769 |
* @static |
|
770 |
* @param {string} label The HTTP header label |
|
771 |
* @param {string} value The HTTP header value |
|
772 |
* @param {string} isDefault Determines if the specific header is a default header |
|
773 | 773 |
* automatically sent with each transaction. |
774 |
* @return {void}
|
|
774 |
* @return {void} |
|
775 | 775 |
*/ |
776 | 776 |
initHeader:function(label, value, isDefault) |
777 | 777 |
{ |
... | ... | |
788 | 788 |
|
789 | 789 |
|
790 | 790 |
/** |
791 |
* @description Accessor that sets the HTTP headers for each transaction.
|
|
792 |
* @method setHeader
|
|
793 |
* @private
|
|
794 |
* @static
|
|
795 |
* @param {object} o The connection object for the transaction.
|
|
796 |
* @return {void}
|
|
791 |
* @description Accessor that sets the HTTP headers for each transaction. |
|
792 |
* @method setHeader |
|
793 |
* @private |
|
794 |
* @static |
|
795 |
* @param {object} o The connection object for the transaction. |
|
796 |
* @return {void} |
|
797 | 797 |
*/ |
798 | 798 |
setHeader:function(o) |
799 | 799 |
{ |
... | ... | |
819 | 819 |
}, |
820 | 820 |
|
821 | 821 |
/** |
822 |
* @description Resets the default HTTP headers object
|
|
823 |
* @method resetDefaultHeaders
|
|
824 |
* @public
|
|
825 |
* @static
|
|
826 |
* @return {void}
|
|
822 |
* @description Resets the default HTTP headers object |
|
823 |
* @method resetDefaultHeaders |
|
824 |
* @public |
|
825 |
* @static |
|
826 |
* @return {void} |
|
827 | 827 |
*/ |
828 | 828 |
resetDefaultHeaders:function(){ |
829 | 829 |
this._default_headers = {}; |
... | ... | |
831 | 831 |
}, |
832 | 832 |
|
833 | 833 |
/** |
834 |
* @description Method to terminate a transaction, if it has not reached readyState 4.
|
|
835 |
* @method abort
|
|
836 |
* @public
|
|
837 |
* @static
|
|
838 |
* @param {object} o The connection object returned by asyncRequest.
|
|
839 |
* @param {object} callback User-defined callback object.
|
|
840 |
* @param {string} isTimeout boolean to indicate if abort resulted from a callback timeout.
|
|
841 |
* @return {boolean}
|
|
834 |
* @description Method to terminate a transaction, if it has not reached readyState 4. |
|
835 |
* @method abort |
|
836 |
* @public |
|
837 |
* @static |
|
838 |
* @param {object} o The connection object returned by asyncRequest. |
|
839 |
* @param {object} callback User-defined callback object. |
|
840 |
* @param {string} isTimeout boolean to indicate if abort resulted from a callback timeout. |
|
841 |
* @return {boolean} |
|
842 | 842 |
*/ |
843 | 843 |
abort:function(o, callback, isTimeout) |
844 | 844 |
{ |
... | ... | |
907 | 907 |
}, |
908 | 908 |
|
909 | 909 |
/** |
910 |
* @description Determines if the transaction is still being processed.
|
|
911 |
* @method isCallInProgress
|
|
912 |
* @public
|
|
913 |
* @static
|
|
914 |
* @param {object} o The connection object returned by asyncRequest
|
|
915 |
* @return {boolean}
|
|
910 |
* @description Determines if the transaction is still being processed. |
|
911 |
* @method isCallInProgress |
|
912 |
* @public |
|
913 |
* @static |
|
914 |
* @param {object} o The connection object returned by asyncRequest |
|
915 |
* @return {boolean} |
|
916 | 916 |
*/ |
917 | 917 |
isCallInProgress:function(o) |
918 | 918 |
{ |
... | ... | |
934 | 934 |
}, |
935 | 935 |
|
936 | 936 |
/** |
937 |
* @description Dereference the XHR instance and the connection object after the transaction is completed.
|
|
938 |
* @method releaseObject
|
|
939 |
* @private
|
|
940 |
* @static
|
|
941 |
* @param {object} o The connection object
|
|
942 |
* @return {void}
|
|
937 |
* @description Dereference the XHR instance and the connection object after the transaction is completed. |
|
938 |
* @method releaseObject |
|
939 |
* @private |
|
940 |
* @static |
|
941 |
* @param {object} o The connection object |
|
942 |
* @return {void} |
|
943 | 943 |
*/ |
944 | 944 |
releaseObject:function(o) |
945 | 945 |
{ |
Also available in: Unified diff
fixed headerinfos