Project

General

Profile

« Previous | Next » 

Revision 1374

Added by Dietmar over 13 years ago

fixed headerinfos

View differences:

connection_core-debug.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
	{
......
250 250
	},
251 251

  
252 252
  /**
253
   * @description Member to override the default POST header.
254
   * @method setDefaultPostHeader
255
   * @public
256
   * @static
257
   * @param {boolean} b Set and use default header - true or false .
258
   * @return void
253
  * @description Member to override the default POST header.
254
  * @method setDefaultPostHeader
255
  * @public
256
  * @static
257
  * @param {boolean} b Set and use default header - true or false .
258
  * @return void
259 259
   */
260 260
	setDefaultPostHeader:function(b)
261 261
	{
......
269 269
	},
270 270

  
271 271
  /**
272
   * @description Member to override the default transaction header..
273
   * @method setDefaultXhrHeader
274
   * @public
275
   * @static
276
   * @param {boolean} b Set and use default header - true or false .
277
   * @return void
272
  * @description Member to override the default transaction header..
273
  * @method setDefaultXhrHeader
274
  * @public
275
  * @static
276
  * @param {boolean} b Set and use default header - true or false .
277
  * @return void
278 278
   */
279 279
	setDefaultXhrHeader:function(b)
280 280
	{
......
288 288
	},
289 289

  
290 290
  /**
291
   * @description Member to modify the default polling interval.
292
   * @method setPollingInterval
293
   * @public
294
   * @static
295
   * @param {int} i The polling interval in milliseconds.
296
   * @return void
291
  * @description Member to modify the default polling interval.
292
  * @method setPollingInterval
293
  * @public
294
  * @static
295
  * @param {int} i The polling interval in milliseconds.
296
  * @return void
297 297
   */
298 298
	setPollingInterval:function(i)
299 299
	{
......
304 304
	},
305 305

  
306 306
  /**
307
   * @description Instantiates a XMLHttpRequest object and returns an object with two properties:
307
  * @description Instantiates a XMLHttpRequest object and returns an object with two properties:
308 308
   * the XMLHttpRequest instance and the transaction id.
309
   * @method createXhrObject
310
   * @private
311
   * @static
312
   * @param {int} transactionId Property containing the transaction id for this transaction.
313
   * @return object
309
  * @method createXhrObject
310
  * @private
311
  * @static
312
  * @param {int} transactionId Property containing the transaction id for this transaction.
313
  * @return object
314 314
   */
315 315
	createXhrObject:function(transactionId)
316 316
	{
......
345 345
	},
346 346

  
347 347
  /**
348
   * @description This method is called by asyncRequest to create a
348
  * @description This method is called by asyncRequest to create a
349 349
   * valid connection object for the transaction.  It also passes a
350 350
   * transaction id and increments the transaction id counter.
351
   * @method getConnectionObject
352
   * @private
353
   * @static
354
   * @return {object}
351
  * @method getConnectionObject
352
  * @private
353
  * @static
354
  * @return {object}
355 355
   */
356 356
	getConnectionObject:function(t)
357 357
	{
......
382 382
	},
383 383

  
384 384
  /**
385
   * @description Method for initiating an asynchronous request via the XHR object.
386
   * @method asyncRequest
387
   * @public
388
   * @static
389
   * @param {string} method HTTP transaction method
390
   * @param {string} uri Fully qualified path of resource
391
   * @param {callback} callback User-defined callback function or object
392
   * @param {string} postData POST body
393
   * @return {object} Returns the connection object
385
  * @description Method for initiating an asynchronous request via the XHR object.
386
  * @method asyncRequest
387
  * @public
388
  * @static
389
  * @param {string} method HTTP transaction method
390
  * @param {string} uri Fully qualified path of resource
391
  * @param {callback} callback User-defined callback function or object
392
  * @param {string} postData POST body
393
  * @return {object} Returns the connection object
394 394
   */
395 395
	asyncRequest:function(method, uri, callback, postData)
396 396
	{
......
495 495
	},
496 496

  
497 497
  /**
498
   * @description This method creates and subscribes custom events,
498
  * @description This method creates and subscribes custom events,
499 499
   * specific to each transaction
500
   * @method initCustomEvents
501
   * @private
502
   * @static
503
   * @param {object} o The connection object
504
   * @param {callback} callback The user-defined callback object
505
   * @return {void}
500
  * @method initCustomEvents
501
  * @private
502
  * @static
503
  * @param {object} o The connection object
504
  * @param {callback} callback The user-defined callback object
505
  * @return {void}
506 506
   */
507 507
	initCustomEvents:function(o, callback)
508 508
	{
......
523 523
	},
524 524

  
525 525
  /**
526
   * @description This method serves as a timer that polls the XHR object's readyState
526
  * @description This method serves as a timer that polls the XHR object's readyState
527 527
   * property during a transaction, instead of binding a callback to the
528 528
   * onreadystatechange event.  Upon readyState 4, handleTransactionResponse
529 529
   * will process the response, and the timer will be cleared.
530
   * @method handleReadyState
531
   * @private
532
   * @static
533
   * @param {object} o The connection object
534
   * @param {callback} callback The user-defined callback object
535
   * @return {void}
530
  * @method handleReadyState
531
  * @private
532
  * @static
533
  * @param {object} o The connection object
534
  * @param {callback} callback The user-defined callback object
535
  * @return {void}
536 536
   */
537 537

  
538 538
    handleReadyState:function(o, callback)
......
574 574
    },
575 575

  
576 576
  /**
577
   * @description This method attempts to interpret the server response and
577
  * @description This method attempts to interpret the server response and
578 578
   * determine whether the transaction was successful, or if an error or
579 579
   * exception was encountered.
580
   * @method handleTransactionResponse
581
   * @private
582
   * @static
583
   * @param {object} o The connection object
584
   * @param {object} callback The user-defined callback object
585
   * @param {boolean} isAbort Determines if the transaction was terminated via abort().
586
   * @return {void}
580
  * @method handleTransactionResponse
581
  * @private
582
  * @static
583
  * @param {object} o The connection object
584
  * @param {object} callback The user-defined callback object
585
  * @param {boolean} isAbort Determines if the transaction was terminated via abort().
586
  * @return {void}
587 587
   */
588 588
    handleTransactionResponse:function(o, callback, isAbort)
589 589
    {
......
694 694
    },
695 695

  
696 696
  /**
697
   * @description This method evaluates the server response, creates and returns the results via
697
  * @description This method evaluates the server response, creates and returns the results via
698 698
   * its properties.  Success and failure cases will differ in the response
699 699
   * object's property values.
700
   * @method createResponseObject
701
   * @private
702
   * @static
703
   * @param {object} o The connection object
704
   * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
705
   * @return {object}
700
  * @method createResponseObject
701
  * @private
702
  * @static
703
  * @param {object} o The connection object
704
  * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
705
  * @return {object}
706 706
   */
707 707
    createResponseObject:function(o, callbackArg)
708 708
    {
......
740 740
    },
741 741

  
742 742
  /**
743
   * @description If a transaction cannot be completed due to dropped or closed connections,
743
  * @description If a transaction cannot be completed due to dropped or closed connections,
744 744
   * there may be not be enough information to build a full response object.
745 745
   * The failure callback will be fired and this specific condition can be identified
746 746
   * by a status property value of 0.
747 747
   *
748 748
   * If an abort was successful, the status property will report a value of -1.
749 749
   *
750
   * @method createExceptionObject
751
   * @private
752
   * @static
753
   * @param {int} tId The Transaction Id
754
   * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
755
   * @param {boolean} isAbort Determines if the exception case is caused by a transaction abort
756
   * @return {object}
750
  * @method createExceptionObject
751
  * @private
752
  * @static
753
  * @param {int} tId The Transaction Id
754
  * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback
755
  * @param {boolean} isAbort Determines if the exception case is caused by a transaction abort
756
  * @return {object}
757 757
   */
758 758
    createExceptionObject:function(tId, callbackArg, isAbort)
759 759
    {
......
781 781
    },
782 782

  
783 783
  /**
784
   * @description Method that initializes the custom HTTP headers for the each transaction.
785
   * @method initHeader
786
   * @public
787
   * @static
788
   * @param {string} label The HTTP header label
789
   * @param {string} value The HTTP header value
790
   * @param {string} isDefault Determines if the specific header is a default header
784
  * @description Method that initializes the custom HTTP headers for the each transaction.
785
  * @method initHeader
786
  * @public
787
  * @static
788
  * @param {string} label The HTTP header label
789
  * @param {string} value The HTTP header value
790
  * @param {string} isDefault Determines if the specific header is a default header
791 791
   * automatically sent with each transaction.
792
   * @return {void}
792
  * @return {void}
793 793
   */
794 794
	initHeader:function(label, value, isDefault)
795 795
	{
......
806 806

  
807 807

  
808 808
  /**
809
   * @description Accessor that sets the HTTP headers for each transaction.
810
   * @method setHeader
811
   * @private
812
   * @static
813
   * @param {object} o The connection object for the transaction.
814
   * @return {void}
809
  * @description Accessor that sets the HTTP headers for each transaction.
810
  * @method setHeader
811
  * @private
812
  * @static
813
  * @param {object} o The connection object for the transaction.
814
  * @return {void}
815 815
   */
816 816
	setHeader:function(o)
817 817
	{
......
839 839
	},
840 840

  
841 841
  /**
842
   * @description Resets the default HTTP headers object
843
   * @method resetDefaultHeaders
844
   * @public
845
   * @static
846
   * @return {void}
842
  * @description Resets the default HTTP headers object
843
  * @method resetDefaultHeaders
844
  * @public
845
  * @static
846
  * @return {void}
847 847
   */
848 848
	resetDefaultHeaders:function(){
849 849
		this._default_headers = {};
......
851 851
	},
852 852

  
853 853
  /**
854
   * @description Method to terminate a transaction, if it has not reached readyState 4.
855
   * @method abort
856
   * @public
857
   * @static
858
   * @param {object} o The connection object returned by asyncRequest.
859
   * @param {object} callback  User-defined callback object.
860
   * @param {string} isTimeout boolean to indicate if abort resulted from a callback timeout.
861
   * @return {boolean}
854
  * @description Method to terminate a transaction, if it has not reached readyState 4.
855
  * @method abort
856
  * @public
857
  * @static
858
  * @param {object} o The connection object returned by asyncRequest.
859
  * @param {object} callback  User-defined callback object.
860
  * @param {string} isTimeout boolean to indicate if abort resulted from a callback timeout.
861
  * @return {boolean}
862 862
   */
863 863
	abort:function(o, callback, isTimeout)
864 864
	{
......
929 929
	},
930 930

  
931 931
  /**
932
   * @description Determines if the transaction is still being processed.
933
   * @method isCallInProgress
934
   * @public
935
   * @static
936
   * @param {object} o The connection object returned by asyncRequest
937
   * @return {boolean}
932
  * @description Determines if the transaction is still being processed.
933
  * @method isCallInProgress
934
  * @public
935
  * @static
936
  * @param {object} o The connection object returned by asyncRequest
937
  * @return {boolean}
938 938
   */
939 939
	isCallInProgress:function(o)
940 940
	{
......
956 956
	},
957 957

  
958 958
  /**
959
   * @description Dereference the XHR instance and the connection object after the transaction is completed.
960
   * @method releaseObject
961
   * @private
962
   * @static
963
   * @param {object} o The connection object
964
   * @return {void}
959
  * @description Dereference the XHR instance and the connection object after the transaction is completed.
960
  * @method releaseObject
961
  * @private
962
  * @static
963
  * @param {object} o The connection object
964
  * @return {void}
965 965
   */
966 966
	releaseObject:function(o)
967 967
	{

Also available in: Unified diff