|
Lines 39-44
Link Here
|
| 39 |
requestQueue.setMaxConcurrentRequests( 1 ); |
39 |
requestQueue.setMaxConcurrentRequests( 1 ); |
| 40 |
// References the currently running request or null if no request is active |
40 |
// References the currently running request or null if no request is active |
| 41 |
this._currentRequest = null; |
41 |
this._currentRequest = null; |
|
|
42 |
//[ariddle] - added for inactive/timeout support |
| 43 |
this._timeoutInterval = 0; |
| 44 |
this._startTime = 0; |
| 45 |
this._inactiveTimer = null; |
| 42 |
}, |
46 |
}, |
| 43 |
|
47 |
|
| 44 |
destruct : function() { |
48 |
destruct : function() { |
|
Lines 76-81
Link Here
|
| 76 |
return this._requestCounter; |
80 |
return this._requestCounter; |
| 77 |
}, |
81 |
}, |
| 78 |
|
82 |
|
|
|
83 |
setTimeoutInterval : function( content ) { |
| 84 |
this._timeoutInterval = content * 1000; |
| 85 |
}, |
| 86 |
|
| 79 |
/** |
87 |
/** |
| 80 |
* Adds a request parameter to this request with the given name and value |
88 |
* Adds a request parameter to this request with the given name and value |
| 81 |
*/ |
89 |
*/ |
|
Lines 118-124
Link Here
|
| 118 |
if( !this._inDelayedSend ) { |
126 |
if( !this._inDelayedSend ) { |
| 119 |
this._inDelayedSend = true; |
127 |
this._inDelayedSend = true; |
| 120 |
var func = function() { |
128 |
var func = function() { |
| 121 |
this._sendImmediate( true ); |
129 |
this._sendImmediate( true ); |
| 122 |
}; |
130 |
}; |
| 123 |
qx.client.Timer.once( func, this, 60 ); |
131 |
qx.client.Timer.once( func, this, 60 ); |
| 124 |
} |
132 |
} |
|
Lines 181-188
Link Here
|
| 181 |
result.addEventListener( "sending", this._handleSending, this ); |
189 |
result.addEventListener( "sending", this._handleSending, this ); |
| 182 |
result.addEventListener( "completed", this._handleCompleted, this ); |
190 |
result.addEventListener( "completed", this._handleCompleted, this ); |
| 183 |
result.addEventListener( "failed", this._handleFailed, this ); |
191 |
result.addEventListener( "failed", this._handleFailed, this ); |
|
|
192 |
this._handleInactiveTimer(); |
| 184 |
return result; |
193 |
return result; |
| 185 |
}, |
194 |
}, |
|
|
195 |
|
| 196 |
//[ariddle] - added for inactive/timeout support |
| 197 |
_handleInactiveTimer : function () { |
| 198 |
if ( this._inactiveTimer == null ) { |
| 199 |
if ( this._timeoutInterval > 0 ) { |
| 200 |
this._inactiveTimer = new qx.client.Timer( this._timeoutInterval ); |
| 201 |
this._inactiveTimer.addEventListener( "interval", |
| 202 |
function () { |
| 203 |
org.eclipse.rwt.ErrorHandler.showTimeout( this._timeoutPage ); |
| 204 |
}, |
| 205 |
this |
| 206 |
); |
| 207 |
this._inactiveTimer.start(); |
| 208 |
} |
| 209 |
} |
| 210 |
else { |
| 211 |
this._inactiveTimer.stop(); |
| 212 |
if ( this._timeoutInterval > 0 ) { |
| 213 |
this._inactiveTimer.startWith( this._timeoutInterval ); |
| 214 |
} |
| 215 |
} |
| 216 |
}, |
| 186 |
|
217 |
|
| 187 |
_sendStandalone : function( request ) { |
218 |
_sendStandalone : function( request ) { |
| 188 |
// TODO [rh] WORKAROUND |
219 |
// TODO [rh] WORKAROUND |
|
Lines 239-245
Link Here
|
| 239 |
org.eclipse.rwt.ErrorHandler.showErrorBox( messageObject.meta.message ); |
270 |
org.eclipse.rwt.ErrorHandler.showErrorBox( messageObject.meta.message ); |
| 240 |
} else { |
271 |
} else { |
| 241 |
org.eclipse.rwt.ErrorHandler.showErrorPage( text ); |
272 |
org.eclipse.rwt.ErrorHandler.showErrorPage( text ); |
| 242 |
} |
273 |
} |
| 243 |
} else { |
274 |
} else { |
| 244 |
var statusCode = String( evt.getStatusCode() ); |
275 |
var statusCode = String( evt.getStatusCode() ); |
| 245 |
text = "<p>Request failed.</p><pre>HTTP Status Code: " + statusCode + "</pre>"; |
276 |
text = "<p>Request failed.</p><pre>HTTP Status Code: " + statusCode + "</pre>"; |
|
Lines 253-274
Link Here
|
| 253 |
_handleCompleted : function( evt ) { |
284 |
_handleCompleted : function( evt ) { |
| 254 |
var exchange = evt.getTarget(); |
285 |
var exchange = evt.getTarget(); |
| 255 |
var text = exchange.getImplementation().getRequest().responseText; |
286 |
var text = exchange.getImplementation().getRequest().responseText; |
| 256 |
var errorOccured = false; |
287 |
var errorOccured = false; |
| 257 |
try { |
288 |
try { |
| 258 |
var messageObject = JSON.parse( text ); |
289 |
var messageObject = JSON.parse( text ); |
| 259 |
org.eclipse.swt.EventUtil.setSuspended( true ); |
290 |
org.eclipse.swt.EventUtil.setSuspended( true ); |
| 260 |
org.eclipse.rwt.protocol.Processor.processMessage( messageObject ); |
291 |
org.eclipse.rwt.protocol.Processor.processMessage( messageObject ); |
| 261 |
org.eclipse.swt.EventUtil.setSuspended( false ); |
292 |
org.eclipse.swt.EventUtil.setSuspended( false ); |
| 262 |
org.eclipse.rwt.UICallBack.getInstance().sendUICallBackRequest(); |
293 |
org.eclipse.rwt.UICallBack.getInstance().sendUICallBackRequest(); |
| 263 |
} catch( ex ) { |
294 |
} catch( ex ) { |
| 264 |
org.eclipse.rwt.ErrorHandler.processJavaScriptErrorInResponse( text, |
295 |
org.eclipse.rwt.ErrorHandler.processJavaScriptErrorInResponse( text, |
| 265 |
ex, |
296 |
ex, |
| 266 |
this._currentRequest ); |
297 |
this._currentRequest ); |
| 267 |
errorOccured = true; |
298 |
errorOccured = true; |
| 268 |
} |
299 |
} |
| 269 |
if( !errorOccured ) { |
300 |
if( !errorOccured ) { |
| 270 |
this._dispatchReceivedEvent(); |
301 |
this._dispatchReceivedEvent(); |
| 271 |
} |
302 |
} |
| 272 |
this._runningRequestCount--; |
303 |
this._runningRequestCount--; |
| 273 |
this._hideWaitHint(); |
304 |
this._hideWaitHint(); |
| 274 |
// [if] Dispose only finished transport - see bug 301261, 317616 |
305 |
// [if] Dispose only finished transport - see bug 301261, 317616 |
|
Lines 316-322
Link Here
|
| 316 |
requestQueue._timer.start(); |
347 |
requestQueue._timer.start(); |
| 317 |
} |
348 |
} |
| 318 |
}, |
349 |
}, |
| 319 |
|
350 |
|
| 320 |
_isConnectionError : qx.core.Variant.select( "qx.client", { |
351 |
_isConnectionError : qx.core.Variant.select( "qx.client", { |
| 321 |
"mshtml" : function( statusCode ) { |
352 |
"mshtml" : function( statusCode ) { |
| 322 |
// for a description of the IE status codes, see |
353 |
// for a description of the IE status codes, see |