@qooxdoo/framework 7.0.0-beta.3 → 7.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/Manifest.json +1 -1
  3. package/README.md +9 -3
  4. package/lib/compiler/compile-info.json +60 -58
  5. package/lib/compiler/index.js +3242 -1883
  6. package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/theme/custom/css/custom.css.map +1 -1
  7. package/lib/resource/qx/tool/loadsass.js +6 -4
  8. package/lib/resource/qx/tool/schema/compile-1-0-0.json +6 -11
  9. package/package.json +17 -3
  10. package/source/class/qx/Bootstrap.js +22 -1
  11. package/source/class/qx/bom/Blocker.js +2 -1
  12. package/source/class/qx/core/Environment.js +3 -12
  13. package/source/class/qx/core/MProperty.js +1 -1
  14. package/source/class/qx/dev/unit/Sinon.js +1 -1
  15. package/source/class/qx/io/__init__.js +5 -3
  16. package/source/class/qx/io/exception/Cancel.js +34 -0
  17. package/source/class/qx/io/exception/Exception.js +38 -0
  18. package/source/class/qx/io/exception/Protocol.js +26 -0
  19. package/source/class/qx/io/exception/Transport.js +39 -0
  20. package/source/class/qx/io/exception/__init__.js +4 -0
  21. package/source/class/qx/io/graphql/Client.js +112 -0
  22. package/source/class/qx/io/graphql/__init__.js +9 -0
  23. package/source/class/qx/io/graphql/protocol/Message.js +65 -0
  24. package/source/class/qx/io/graphql/protocol/Request.js +95 -0
  25. package/source/class/qx/io/graphql/protocol/Response.js +61 -0
  26. package/source/class/qx/io/graphql/protocol/__init__.js +6 -0
  27. package/source/class/qx/io/jsonrpc/Client.js +323 -0
  28. package/source/class/qx/io/jsonrpc/__init__.js +15 -0
  29. package/source/class/qx/io/jsonrpc/protocol/Batch.js +97 -0
  30. package/source/class/qx/io/jsonrpc/protocol/Error.js +63 -0
  31. package/source/class/qx/io/jsonrpc/protocol/Message.js +48 -0
  32. package/source/class/qx/io/jsonrpc/protocol/Notification.js +45 -0
  33. package/source/class/qx/io/jsonrpc/protocol/Parser.js +81 -0
  34. package/source/class/qx/io/jsonrpc/protocol/Request.js +93 -0
  35. package/source/class/qx/io/jsonrpc/protocol/Result.js +48 -0
  36. package/source/class/qx/io/jsonrpc/protocol/__init__.js +5 -0
  37. package/source/class/qx/io/request/authentication/Bearer.js +52 -0
  38. package/source/class/qx/io/transport/AbstractClient.js +100 -0
  39. package/source/class/qx/io/transport/AbstractTransport.js +41 -0
  40. package/source/class/qx/io/transport/Fetch.js +95 -0
  41. package/source/class/qx/io/transport/ITransport.js +40 -0
  42. package/source/class/qx/io/transport/PostMessage.js +55 -0
  43. package/source/class/qx/io/transport/Websocket.js +97 -0
  44. package/source/class/qx/io/transport/Xhr.js +139 -0
  45. package/source/class/qx/io/transport/__init__.js +18 -0
  46. package/source/class/qx/test/core/Assert.js +1 -1
  47. package/source/class/qx/test/core/Environment.js +0 -3
  48. package/source/class/qx/test/io/MAssert.js +46 -0
  49. package/source/class/qx/test/io/graphql/Client.js +169 -0
  50. package/source/class/qx/test/io/graphql/ClientFetch.js +34 -0
  51. package/source/class/qx/test/io/graphql/Request.js +42 -0
  52. package/source/class/qx/test/io/jsonrpc/Client.js +267 -0
  53. package/source/class/qx/test/io/jsonrpc/Protocol.js +80 -0
  54. package/source/class/qx/test/io/transport/PostMessage.js +56 -0
  55. package/source/class/qx/test/io/transport/Websocket.js +63 -0
  56. package/source/class/qx/test/ui/embed/Iframe.js +1 -1
  57. package/source/class/qx/test/util/DateFormat.js +45 -6
  58. package/source/class/qx/tool/cli/Cli.js +1 -0
  59. package/source/class/qx/tool/cli/commands/Compile.js +13 -3
  60. package/source/class/qx/tool/cli/commands/Es6ify.js +93 -0
  61. package/source/class/qx/tool/cli/commands/package/Install.js +1 -1
  62. package/source/class/qx/tool/cli/commands/package/Publish.js +14 -0
  63. package/source/class/qx/tool/compiler/ClassFile.js +67 -27
  64. package/source/class/qx/tool/compiler/Es6ify.js +368 -0
  65. package/source/class/qx/tool/compiler/makers/AppMaker.js +2 -1
  66. package/source/class/qx/tool/compiler/targets/Target.js +57 -47
  67. package/source/class/qx/tool/compiler/targets/meta/AbstractJavascriptMeta.js +25 -18
  68. package/source/class/qx/tool/compiler/targets/meta/BootJs.js +16 -16
  69. package/source/class/qx/tool/compiler/targets/meta/PolyfillJs.js +11 -3
  70. package/source/class/qx/tool/compiler/targets/meta/Uglify.js +10 -10
  71. package/source/class/qx/ui/core/Widget.js +70 -0
  72. package/source/class/qx/ui/decoration/MLinearBackgroundGradient.js +2 -1
  73. package/source/class/qx/ui/form/ComboBox.js +8 -3
  74. package/source/class/qx/ui/form/DateField.js +16 -1
  75. package/source/class/qx/ui/form/MenuButton.js +8 -4
  76. package/source/class/qx/ui/form/SelectBox.js +8 -3
  77. package/source/class/qx/ui/menu/AbstractButton.js +12 -8
  78. package/source/class/qx/ui/menu/Menu.js +18 -8
  79. package/source/class/qx/ui/table/pane/Model.js +10 -4
  80. package/source/class/qx/ui/window/Window.js +8 -0
  81. package/source/class/qx/util/format/DateFormat.js +44 -17
  82. package/source/resource/qx/tool/loadsass.js +6 -4
  83. package/source/resource/qx/tool/schema/compile-1-0-0.json +6 -11
  84. package/source/translation/hr.po +297 -0
  85. package/lib/resource/qx/static/blank.gif +0 -0
  86. package/source/class/qx/io/remote/Exchange.js +0 -1063
  87. package/source/class/qx/io/remote/Request.js +0 -1021
  88. package/source/class/qx/io/remote/RequestQueue.js +0 -521
  89. package/source/class/qx/io/remote/Response.js +0 -137
  90. package/source/class/qx/io/remote/Rpc.js +0 -1075
  91. package/source/class/qx/io/remote/RpcError.js +0 -198
  92. package/source/class/qx/io/remote/__init__.js +0 -88
  93. package/source/class/qx/io/remote/transport/Abstract.js +0 -513
  94. package/source/class/qx/io/remote/transport/Iframe.js +0 -652
  95. package/source/class/qx/io/remote/transport/Script.js +0 -475
  96. package/source/class/qx/io/remote/transport/XmlHttp.js +0 -1019
  97. package/source/class/qx/io/remote/transport/__init__.js +0 -3
  98. package/source/class/qx/test/io/remote/AbstractRequest.js +0 -150
  99. package/source/class/qx/test/io/remote/RequestIframe.js +0 -105
  100. package/source/class/qx/test/io/remote/RequestXhr.js +0 -151
  101. package/source/class/qx/test/io/remote/Rpc.js +0 -205
  102. package/source/class/qx/test/io/remote/__init__.js +0 -4
  103. package/source/class/qx/test/io/remote/transport/Iframe.js +0 -67
  104. package/source/class/qx/test/io/remote/transport/XmlHttp.js +0 -133
  105. package/source/class/qx/test/io/remote/transport/__init__.js +0 -4
@@ -1,1021 +0,0 @@
1
- /* ************************************************************************
2
-
3
- qooxdoo - the new era of web development
4
-
5
- http://qooxdoo.org
6
-
7
- Copyright:
8
- 2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
9
- 2006 Derrell Lipman
10
-
11
- License:
12
- MIT: https://opensource.org/licenses/MIT
13
- See the LICENSE file in the project's top-level directory for details.
14
-
15
- Authors:
16
- * Sebastian Werner (wpbasti)
17
- * Andreas Ecker (ecker)
18
- * Derrell Lipman (derrell)
19
-
20
- ************************************************************************ */
21
-
22
- /**
23
- * This class is used to send HTTP requests to the server.
24
- *
25
- * NOTE: Instances of this class must be disposed of after use
26
- *
27
- */
28
- qx.Class.define("qx.io.remote.Request",
29
- {
30
- extend : qx.core.Object,
31
- implement : [ qx.core.IDisposable ],
32
-
33
-
34
-
35
-
36
- /*
37
- *****************************************************************************
38
- CONSTRUCTOR
39
- *****************************************************************************
40
- */
41
-
42
- /**
43
- * @param vUrl {String}
44
- * Target url to issue the request to.
45
- *
46
- * @param vMethod {String}
47
- * Determines http method (GET, POST, PUT, etc.) to use. See "method" property
48
- * for valid values and default value.
49
- *
50
- * @param vResponseType {String}
51
- * The mime type of the response. Default is text/plain.
52
- */
53
- construct : function(vUrl, vMethod, vResponseType)
54
- {
55
- this.base(arguments);
56
-
57
- this.__requestHeaders = {};
58
- this.__urlParameters = {};
59
- this.__dataParameters = {};
60
- this.__formFields = {};
61
-
62
- if (vUrl !== undefined) {
63
- this.setUrl(vUrl);
64
- }
65
-
66
- if (vMethod !== undefined) {
67
- this.setMethod(vMethod);
68
- }
69
-
70
- if (vResponseType !== undefined) {
71
- this.setResponseType(vResponseType);
72
- }
73
-
74
- this.setProhibitCaching(true);
75
-
76
- // Get the next sequence number for this request
77
- this.__seqNum = ++qx.io.remote.Request.__seqNum;
78
- },
79
-
80
-
81
-
82
-
83
- /*
84
- *****************************************************************************
85
- EVENTS
86
- *****************************************************************************
87
- */
88
-
89
- events : {
90
-
91
- /** Fired when the Request object changes its state to 'created' */
92
- "created" : "qx.event.type.Event",
93
-
94
- /** Fired when the Request object changes its state to 'configured' */
95
- "configured" : "qx.event.type.Event",
96
-
97
- /** Fired when the Request object changes its state to 'sending' */
98
- "sending" : "qx.event.type.Event",
99
-
100
- /** Fired when the Request object changes its state to 'receiving' */
101
- "receiving" : "qx.event.type.Event",
102
-
103
- /**
104
- * Fired once the request has finished successfully. The event object
105
- * can be used to read the transferred data.
106
- */
107
- "completed" : "qx.io.remote.Response",
108
-
109
- /** Fired when the pending request has been aborted. */
110
- "aborted" : "qx.event.type.Event",
111
-
112
- /** Fired when the pending request fails. */
113
- "failed" : "qx.io.remote.Response",
114
-
115
- /** Fired when the pending request times out. */
116
- "timeout" : "qx.io.remote.Response"
117
- },
118
-
119
-
120
-
121
- /*
122
- *****************************************************************************
123
- STATICS
124
- *****************************************************************************
125
- */
126
-
127
- statics :
128
- {
129
- /*
130
- ---------------------------------------------------------------------------
131
- SEQUENCE NUMBER
132
- ---------------------------------------------------------------------------
133
- */
134
-
135
- /**
136
- * Sequence (id) number of a request, used to associate a response or error
137
- * with its initiating request.
138
- */
139
- __seqNum : 0,
140
-
141
- /**
142
- * Returns true if the given HTTP method allows a request body being transferred to the server.
143
- * This is currently POST and PUT. Other methods require their data being encoded into
144
- * the URL
145
- *
146
- * @param httpMethod {String} one of the values of the method property
147
- * @return {Boolean}
148
- */
149
- methodAllowsRequestBody : function(httpMethod) {
150
- return (httpMethod == "POST") || (httpMethod == "PUT");
151
- }
152
-
153
- },
154
-
155
-
156
-
157
-
158
- /*
159
- *****************************************************************************
160
- PROPERTIES
161
- *****************************************************************************
162
- */
163
-
164
- properties :
165
- {
166
- /**
167
- * Target url to issue the request to.
168
- */
169
- url :
170
- {
171
- check : "String",
172
- init : ""
173
- },
174
-
175
-
176
- /**
177
- * Determines what type of request to issue (GET, POST, PUT, HEAD, DELETE).
178
- */
179
- method :
180
- {
181
- check : [ "GET", "POST", "PUT", "HEAD", "DELETE" ],
182
- apply : "_applyMethod",
183
- init : "GET"
184
- },
185
-
186
-
187
- /**
188
- * Set the request to asynchronous.
189
- */
190
- asynchronous :
191
- {
192
- check : "Boolean",
193
- init : true
194
- },
195
-
196
-
197
- /**
198
- * Set the data to be sent via this request
199
- */
200
- data :
201
- {
202
- check : "String",
203
- nullable : true
204
- },
205
-
206
-
207
- /**
208
- * Username to use for HTTP authentication.
209
- * Set to NULL if HTTP authentication is not used.
210
- */
211
- username :
212
- {
213
- check : "String",
214
- nullable : true
215
- },
216
-
217
-
218
- /**
219
- * Password to use for HTTP authentication.
220
- * Set to NULL if HTTP authentication is not used.
221
- */
222
- password :
223
- {
224
- check : "String",
225
- nullable : true
226
- },
227
-
228
-
229
- /**
230
- * The state that the request is in, while being processed.
231
- */
232
- state :
233
- {
234
- check : [ "configured", "queued", "sending", "receiving", "completed", "aborted", "timeout", "failed" ],
235
- init : "configured",
236
- apply : "_applyState",
237
- event : "changeState"
238
- },
239
-
240
-
241
- /**
242
- * Response type of request.
243
- *
244
- * The response type is a MIME type, default is text/plain. Other supported
245
- * MIME types are text/javascript, text/html, application/json,
246
- * application/xml.
247
- */
248
- responseType :
249
- {
250
- check : [ "text/plain", "text/javascript", "application/json", "application/xml", "text/html" ],
251
- init : "text/plain",
252
- apply : "_applyResponseType"
253
- },
254
-
255
-
256
- /**
257
- * Number of milliseconds before the request is being timed out.
258
- *
259
- * If this property is null, the timeout for the request comes is the
260
- * qx.io.remote.RequestQueue's property defaultTimeout.
261
- */
262
- timeout :
263
- {
264
- check : "Integer",
265
- nullable : true
266
- },
267
-
268
-
269
- /**
270
- * Prohibit request from being cached.
271
- *
272
- * Setting the value to <i>true</i> adds a parameter "nocache" to the
273
- * request URL with a value of the current time, as well as adding request
274
- * headers Pragma:no-cache and Cache-Control:no-cache.
275
- *
276
- * Setting the value to <i>false</i> removes the parameter and request
277
- * headers.
278
- *
279
- * As a special case, this property may be set to the string value
280
- * "no-url-params-on-post" which will prevent the nocache parameter from
281
- * being added to the URL if the POST method is used but will still add
282
- * the Pragma and Cache-Control headers. This is useful if your backend
283
- * does nasty things like mixing parameters specified in the URL into
284
- * form fields in the POST request. (One example of this nasty behavior
285
- * is known as "mixed mode" in Oracle, as described here:
286
- * http://docs.oracle.com/cd/B32110_01/web.1013/b28963/concept.htm#i1005684)
287
- */
288
- prohibitCaching :
289
- {
290
- check : function(v)
291
- {
292
- return typeof v == "boolean" || v === "no-url-params-on-post";
293
- },
294
- init : true,
295
- apply : "_applyProhibitCaching"
296
- },
297
-
298
-
299
- /**
300
- * Indicate that the request is cross domain.
301
- *
302
- * A request is cross domain if the request's URL points to a host other than
303
- * the local host. This switches the concrete implementation that is used for
304
- * sending the request from qx.io.remote.transport.XmlHttp to
305
- * qx.io.remote.transport.Script, because only the latter can handle cross
306
- * domain requests.
307
- */
308
- crossDomain :
309
- {
310
- check : "Boolean",
311
- init : false
312
- },
313
-
314
-
315
- /**
316
- * Indicate that the request will be used for a file upload.
317
- *
318
- * The request will be used for a file upload. This switches the concrete
319
- * implementation that is used for sending the request from
320
- * qx.io.remote.transport.XmlHttp to qx.io.remote.IFrameTransport, because only
321
- * the latter can handle file uploads.
322
- */
323
- fileUpload :
324
- {
325
- check : "Boolean",
326
- init : false
327
- },
328
-
329
-
330
- /**
331
- * The transport instance used for the request.
332
- *
333
- * This is necessary to be able to abort an asynchronous request.
334
- */
335
- transport :
336
- {
337
- check : "qx.io.remote.Exchange",
338
- nullable : true
339
- },
340
-
341
-
342
- /**
343
- * Use Basic HTTP Authentication.
344
- */
345
- useBasicHttpAuth :
346
- {
347
- check : "Boolean",
348
- init : false
349
- },
350
-
351
- /**
352
- * If true and the responseType property is set to "application/json", getContent() will
353
- * return a Javascript map containing the JSON contents, i. e. the result qx.lang.Json.parse().
354
- * If false, the raw string data will be returned and the parsing must be done manually.
355
- * This is useful for special JSON dialects / extensions which are not supported by
356
- * qx.lang.Json.
357
- *
358
- * Note that this is currently only respected by qx.io.remote.transport.XmlHttp, i. e.
359
- * if the transport used is the one using XMLHttpRequests. The other transports
360
- * do not support JSON parsing, so this property has no effect.
361
- */
362
- parseJson :
363
- {
364
- check : "Boolean",
365
- init : true
366
- }
367
- },
368
-
369
-
370
-
371
-
372
- /*
373
- *****************************************************************************
374
- MEMBERS
375
- *****************************************************************************
376
- */
377
-
378
- members :
379
- {
380
-
381
- __requestHeaders : null,
382
- __urlParameters : null,
383
- __dataParameters : null,
384
- __formFields : null,
385
- __seqNum : null,
386
-
387
- /*
388
- ---------------------------------------------------------------------------
389
- CORE METHODS
390
- ---------------------------------------------------------------------------
391
- */
392
-
393
- /**
394
- * Schedule this request for transport to server.
395
- *
396
- * The request is added to the singleton class qx.io.remote.RequestQueue's
397
- * list of pending requests.
398
- *
399
- */
400
- send : function() {
401
- qx.io.remote.RequestQueue.getInstance().add(this);
402
- },
403
-
404
-
405
- /**
406
- * Abort sending this request.
407
- *
408
- * The request is removed from the singleton class qx.io.remote.RequestQueue's
409
- * list of pending events. If the request haven't been scheduled this
410
- * method is a noop.
411
- *
412
- */
413
- abort : function() {
414
- qx.io.remote.RequestQueue.getInstance().abort(this);
415
- },
416
-
417
-
418
- /**
419
- * Abort sending this request if it has not already been aborted.
420
- *
421
- */
422
- reset : function()
423
- {
424
- switch(this.getState())
425
- {
426
- case "sending":
427
- case "receiving":
428
- this.error("Aborting already sent request!");
429
-
430
- // no break
431
-
432
- case "queued":
433
- this.abort();
434
- break;
435
- }
436
- },
437
-
438
-
439
-
440
-
441
- /*
442
- ---------------------------------------------------------------------------
443
- STATE ALIASES
444
- ---------------------------------------------------------------------------
445
- */
446
-
447
- /**
448
- * Determine if this request is in the configured state.
449
- *
450
- * @return {Boolean} <true> if the request is in the configured state; <false> otherwise.
451
- */
452
- isConfigured : function() {
453
- return this.getState() === "configured";
454
- },
455
-
456
-
457
- /**
458
- * Determine if this request is in the queued state.
459
- *
460
- * @return {Boolean} <true> if the request is in the queued state; <false> otherwise.
461
- */
462
- isQueued : function() {
463
- return this.getState() === "queued";
464
- },
465
-
466
-
467
- /**
468
- * Determine if this request is in the sending state.
469
- *
470
- * @return {Boolean} <true> if the request is in the sending state; <false> otherwise.
471
- */
472
- isSending : function() {
473
- return this.getState() === "sending";
474
- },
475
-
476
-
477
- /**
478
- * Determine if this request is in the receiving state.
479
- *
480
- * @return {Boolean} <true> if the request is in the receiving state; <false> otherwise.
481
- */
482
- isReceiving : function() {
483
- return this.getState() === "receiving";
484
- },
485
-
486
-
487
- /**
488
- * Determine if this request is in the completed state.
489
- *
490
- * @return {Boolean} <true> if the request is in the completed state; <false> otherwise.
491
- */
492
- isCompleted : function() {
493
- return this.getState() === "completed";
494
- },
495
-
496
-
497
- /**
498
- * Determine if this request is in the aborted state.
499
- *
500
- * @return {Boolean} <true> if the request is in the aborted state; <false> otherwise.
501
- */
502
- isAborted : function() {
503
- return this.getState() === "aborted";
504
- },
505
-
506
-
507
- /**
508
- * Determine if this request is in the timeout state.
509
- *
510
- * @return {Boolean} <true> if the request is in the timeout state; <false> otherwise.
511
- */
512
- isTimeout : function() {
513
- return this.getState() === "timeout";
514
- },
515
-
516
-
517
- /**
518
- * Determine if this request is in the failed state.
519
- *
520
- * @return {Boolean} <true> if the request is in the failed state; <false> otherwise.
521
- */
522
- isFailed : function() {
523
- return this.getState() === "failed";
524
- },
525
-
526
-
527
-
528
-
529
- /*
530
- ---------------------------------------------------------------------------
531
- EVENT HANDLER
532
- ---------------------------------------------------------------------------
533
- */
534
-
535
- /**
536
- * Dispatches a clone of the given event on this instance
537
- *
538
- * @param e {qx.event.type.Event} The original event
539
- */
540
- __forwardEvent : qx.event.GlobalError.observeMethod(function(e)
541
- {
542
- var clonedEvent = e.clone();
543
- clonedEvent.setTarget(this);
544
- this.dispatchEvent(clonedEvent);
545
- }),
546
-
547
-
548
-
549
- /**
550
- * Event handler called when the request enters the queued state.
551
- *
552
- * @param e {qx.event.type.Event} Event indicating state change
553
- */
554
- _onqueued : function(e)
555
- {
556
- // Modify internal state
557
- this.setState("queued");
558
-
559
- // Bubbling up
560
- this.__forwardEvent(e);
561
- },
562
-
563
-
564
- /**
565
- * Event handler called when the request enters the sending state.
566
- *
567
- * @param e {qx.event.type.Event} Event indicating state change
568
- */
569
- _onsending : function(e)
570
- {
571
- // Modify internal state
572
- this.setState("sending");
573
-
574
- // Bubbling up
575
- this.__forwardEvent(e);
576
- },
577
-
578
-
579
- /**
580
- * Event handler called when the request enters the receiving state.
581
- *
582
- * @param e {qx.event.type.Event} Event indicating state change
583
- */
584
- _onreceiving : function(e)
585
- {
586
- // Modify internal state
587
- this.setState("receiving");
588
-
589
- // Bubbling up
590
- this.__forwardEvent(e);
591
- },
592
-
593
-
594
- /**
595
- * Event handler called when the request enters the completed state.
596
- *
597
- * @param e {qx.event.type.Event} Event indicating state change
598
- */
599
- _oncompleted : function(e)
600
- {
601
- // Modify internal state
602
- this.setState("completed");
603
-
604
- // Bubbling up
605
- this.__forwardEvent(e);
606
-
607
- // Automatically dispose after event completion
608
- this.dispose();
609
- },
610
-
611
-
612
- /**
613
- * Event handler called when the request enters the aborted state.
614
- *
615
- * @param e {qx.event.type.Event} Event indicating state change
616
- */
617
- _onaborted : function(e)
618
- {
619
- // Modify internal state
620
- this.setState("aborted");
621
-
622
- // Bubbling up
623
- this.__forwardEvent(e);
624
-
625
- // Automatically dispose after event completion
626
- this.dispose();
627
- },
628
-
629
-
630
- /**
631
- * Event handler called when the request enters the timeout state.
632
- *
633
- * @param e {qx.event.type.Event} Event indicating state change
634
- */
635
- _ontimeout : function(e)
636
- {
637
- /*
638
- // User's handler can block until timeout.
639
- switch(this.getState())
640
- {
641
- // If we're no longer running...
642
- case "completed":
643
- case "timeout":
644
- case "aborted":
645
- case "failed":
646
- // then don't bubble up the timeout event
647
- return;
648
- }
649
-
650
-
651
- */ // Modify internal state
652
- this.setState("timeout");
653
-
654
- // Bubbling up
655
- this.__forwardEvent(e);
656
-
657
- // Automatically dispose after event completion
658
- this.dispose();
659
- },
660
-
661
-
662
- /**
663
- * Event handler called when the request enters the failed state.
664
- *
665
- * @param e {qx.event.type.Event} Event indicating state change
666
- */
667
- _onfailed : function(e)
668
- {
669
- // Modify internal state
670
- this.setState("failed");
671
-
672
- // Bubbling up
673
- this.__forwardEvent(e);
674
-
675
- // Automatically dispose after event completion
676
- this.dispose();
677
- },
678
-
679
-
680
-
681
-
682
- /*
683
- ---------------------------------------------------------------------------
684
- APPLY ROUTINES
685
- ---------------------------------------------------------------------------
686
- */
687
-
688
- // property apply
689
- _applyState : function(value, old)
690
- {
691
- if (qx.core.Environment.get("qx.debug"))
692
- {
693
- if (qx.core.Environment.get("qx.debug.io.remote")) {
694
- this.debug("State: " + value);
695
- }
696
- }
697
- },
698
-
699
-
700
- // property apply
701
- _applyProhibitCaching : function(value, old)
702
- {
703
- if (! value)
704
- {
705
- this.removeParameter("nocache");
706
- this.removeRequestHeader("Pragma");
707
- this.removeRequestHeader("Cache-Control");
708
- return;
709
- }
710
-
711
- // If value isn't "no-url-params-on-post" or this isn't a POST request
712
- if (value !== "no-url-params-on-post" ||
713
- this.getMethod() != "POST")
714
- {
715
- // ... then add a parameter to the URL to make it unique on each
716
- // request. The actual id, "nocache" is irrelevant; it's the fact
717
- // that a (usually) different date is added to the URL on each request
718
- // that prevents caching.
719
- this.setParameter("nocache", new Date().valueOf());
720
- }
721
- else
722
- {
723
- // Otherwise, we don't want the nocache parameter in the URL.
724
- this.removeParameter("nocache");
725
- }
726
-
727
- // Add the HTTP 1.0 request to avoid use of a cache
728
- this.setRequestHeader("Pragma", "no-cache");
729
-
730
- // Add the HTTP 1.1 request to avoid use of a cache
731
- this.setRequestHeader("Cache-Control", "no-cache");
732
- },
733
-
734
-
735
- // property apply
736
- _applyMethod : function(value, old)
737
- {
738
- if (qx.io.remote.Request.methodAllowsRequestBody(value)) {
739
- this.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
740
- } else {
741
- this.removeRequestHeader("Content-Type");
742
- }
743
-
744
- // Re-test the prohibit caching property. We may need to add or remove
745
- // the "nocache" parameter. We explicitly call the _apply method since
746
- // it wouldn't be called normally when setting the value to its already
747
- // existant value.
748
- var prohibitCaching = this.getProhibitCaching();
749
- this._applyProhibitCaching(prohibitCaching, prohibitCaching);
750
- },
751
-
752
-
753
- // property apply
754
- _applyResponseType : function(value, old) {
755
- this.setRequestHeader("X-Qooxdoo-Response-Type", value);
756
- },
757
-
758
-
759
-
760
-
761
- /*
762
- ---------------------------------------------------------------------------
763
- REQUEST HEADER
764
- ---------------------------------------------------------------------------
765
- */
766
-
767
- /**
768
- * Add a request header to the request.
769
- *
770
- * Example: request.setRequestHeader("Content-Type", "text/html")
771
- *
772
- * Please note: Some browsers, such as Safari 3 and 4, will capitalize
773
- * header field names. This is in accordance with RFC 2616[1], which states
774
- * that HTTP 1.1 header names are case-insensitive, so your server backend
775
- * should be case-agnostic when dealing with request headers.
776
- *
777
- * [1]<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2">RFC 2616: HTTP Message Headers</a>
778
- *
779
- * @param vId {String} The identifier to use for this added header
780
- * @param vValue {String} The value to use for this added header
781
- */
782
- setRequestHeader : function(vId, vValue) {
783
- this.__requestHeaders[vId] = vValue;
784
- },
785
-
786
-
787
- /**
788
- * Remove a previously-added request header
789
- *
790
- * @param vId {String} The id of the header to be removed
791
- */
792
- removeRequestHeader : function(vId) {
793
- delete this.__requestHeaders[vId];
794
- },
795
-
796
-
797
- /**
798
- * Retrieve the value of a header which was previously set
799
- *
800
- * @param vId {String} The id of the header value being requested
801
- * @return {String} The value of the header with the specified id
802
- */
803
- getRequestHeader : function(vId) {
804
- return this.__requestHeaders[vId] || null;
805
- },
806
-
807
-
808
- /**
809
- * Return the object containing all of the headers which have been added.
810
- *
811
- * @return {Object} The returned object has as its property names each of the ids of headers
812
- * which have been added, and as each property value, the value of the
813
- * property corresponding to that id.
814
- */
815
- getRequestHeaders : function() {
816
- return this.__requestHeaders;
817
- },
818
-
819
-
820
-
821
-
822
- /*
823
- ---------------------------------------------------------------------------
824
- PARAMETERS
825
- ---------------------------------------------------------------------------
826
- */
827
-
828
- /**
829
- * Add a parameter to the request.
830
- *
831
- * @param vId {String}
832
- * String identifier of the parameter to add.
833
- *
834
- * @param vValue {var}
835
- * Value of parameter. May be a string (for one parameter) or an array
836
- * of strings (for setting multiple parameter values with the same
837
- * parameter name).
838
- *
839
- * @param bAsData {Boolean}
840
- * If <i>false</i>, add the parameter to the URL. If <i>true</i> then
841
- * instead the parameters added by calls to this method will be combined
842
- * into a string added as the request data, as if the entire set of
843
- * parameters had been pre-build and passed to setData().
844
- *
845
- * Note: Parameters requested to be sent as data will be silently dropped
846
- * if data is manually added via a call to setData().
847
- *
848
- * Note: Some transports, e.g. Script, do not support passing parameters
849
- * as data.
850
- *
851
- */
852
- setParameter : function(vId, vValue, bAsData)
853
- {
854
- if (bAsData)
855
- {
856
- this.__dataParameters[vId] = vValue;
857
- }
858
- else
859
- {
860
- this.__urlParameters[vId] = vValue;
861
- }
862
- },
863
-
864
-
865
- /**
866
- * Remove a parameter from the request.
867
- *
868
- * @param vId {String}
869
- * Identifier of the parameter to remove.
870
- *
871
- * @param bFromData {Boolean}
872
- * If <i>false</i> then remove the parameter of the URL parameter list.
873
- * If <i>true</i> then remove it from the list of parameters to be sent
874
- * as request data.
875
- *
876
- */
877
- removeParameter : function(vId, bFromData)
878
- {
879
- if (bFromData)
880
- {
881
- delete this.__dataParameters[vId];
882
- }
883
- else
884
- {
885
- delete this.__urlParameters[vId];
886
- }
887
- },
888
-
889
-
890
- /**
891
- * Get a parameter in the request.
892
- *
893
- * @param vId {String}
894
- * Identifier of the parameter to get.
895
- *
896
- * @param bFromData {Boolean}
897
- * If <i>false</i> then retrieve the parameter from the URL parameter
898
- * list. If <i>true</i> then retrieve it from the list of parameters to
899
- * be sent as request data.
900
- *
901
- * @return {var}
902
- * The requested parameter value
903
- *
904
- */
905
- getParameter : function(vId, bFromData)
906
- {
907
- if (bFromData)
908
- {
909
- return this.__dataParameters[vId] || null;
910
- }
911
- else
912
- {
913
- return this.__urlParameters[vId] || null;
914
- }
915
- },
916
-
917
-
918
- /**
919
- * Returns the object containing all parameters for the request.
920
- *
921
- * @param bFromData {Boolean}
922
- * If <i>false</i> then retrieve the URL parameter list.
923
- * If <i>true</i> then retrieve the data parameter list.
924
- *
925
- * @return {Object}
926
- * The returned object has as its property names each of the ids of
927
- * parameters which have been added, and as each property value, the
928
- * value of the property corresponding to that id.
929
- */
930
- getParameters : function(bFromData)
931
- {
932
- return (bFromData ? this.__dataParameters : this.__urlParameters);
933
- },
934
-
935
-
936
-
937
-
938
- /*
939
- ---------------------------------------------------------------------------
940
- FORM FIELDS
941
- ---------------------------------------------------------------------------
942
- */
943
-
944
- /**
945
- * Add a form field to the POST request.
946
- *
947
- * NOTE: Adding any programmatic form fields using this method will switch the
948
- * Transport implementation to IframeTransport.
949
- *
950
- * NOTE: Use of these programmatic form fields disallow use of synchronous
951
- * requests and cross-domain requests. Be sure that you do not need
952
- * those features when setting these programmatic form fields.
953
- *
954
- * @param vId {String} String identifier of the form field to add.
955
- * @param vValue {String} Value of form field
956
- */
957
- setFormField : function(vId, vValue) {
958
- this.__formFields[vId] = vValue;
959
- },
960
-
961
-
962
- /**
963
- * Remove a form field from the POST request.
964
- *
965
- * @param vId {String} Identifier of the form field to remove.
966
- */
967
- removeFormField : function(vId) {
968
- delete this.__formFields[vId];
969
- },
970
-
971
-
972
- /**
973
- * Get a form field in the POST request.
974
- *
975
- * @param vId {String} Identifier of the form field to get.
976
- * @return {String|null} Value of form field or <code>null</code> if no value
977
- * exists for the passed identifier.
978
- */
979
- getFormField : function(vId) {
980
- return this.__formFields[vId] || null;
981
- },
982
-
983
-
984
- /**
985
- * Returns the object containing all form fields for the POST request.
986
- *
987
- * @return {Object} The returned object has as its property names each of the ids of
988
- * form fields which have been added, and as each property value, the value
989
- * of the property corresponding to that id.
990
- */
991
- getFormFields : function() {
992
- return this.__formFields;
993
- },
994
-
995
-
996
- /**
997
- * Obtain the sequence (id) number used for this request
998
- *
999
- * @return {Integer} The sequence number of this request
1000
- */
1001
- getSequenceNumber : function() {
1002
- return this.__seqNum;
1003
- }
1004
- },
1005
-
1006
-
1007
-
1008
-
1009
- /*
1010
- *****************************************************************************
1011
- DESTRUCTOR
1012
- *****************************************************************************
1013
- */
1014
-
1015
- destruct : function()
1016
- {
1017
- this.setTransport(null);
1018
- this.__requestHeaders = this.__urlParameters = this.__dataParameters =
1019
- this.__formFields = null;
1020
- }
1021
- });