Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 213782 Details for
Bug 376367
Improve Session Timeout Responsiveness and Customizability
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch that implements a custom timeout page and interval
timeoutpatch.txt (text/plain), 12.80 KB, created by
Austin Riddle
on 2012-04-09 20:48:21 EDT
(
hide
)
Description:
Patch that implements a custom timeout page and interval
Filename:
MIME Type:
Creator:
Austin Riddle
Created:
2012-04-09 20:48:21 EDT
Size:
12.80 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: js/org/eclipse/rwt/Display.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/js/org/eclipse/rwt/Display.js,v >retrieving revision 1.16 >diff -u -r1.16 Display.js >--- js/org/eclipse/rwt/Display.js 4 Apr 2012 13:48:39 -0000 1.16 >+++ js/org/eclipse/rwt/Display.js 10 Apr 2012 00:46:28 -0000 >@@ -78,6 +78,10 @@ > org.eclipse.swt.theme.ThemeStore.getInstance().setCurrentTheme( themeId ); > }, > >+ setTimeoutInterval : function( content ) { >+ org.eclipse.swt.Request.getInstance().setTimeoutInterval( content ); >+ }, >+ > setEnableUiTests : function( value ) { > qx.ui.core.Widget._renderHtmlIds = value; > }, >Index: js/org/eclipse/rwt/DisplayAdapter.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/js/org/eclipse/rwt/DisplayAdapter.js,v >retrieving revision 1.12 >diff -u -r1.12 DisplayAdapter.js >--- js/org/eclipse/rwt/DisplayAdapter.js 7 Mar 2012 16:08:59 -0000 1.12 >+++ js/org/eclipse/rwt/DisplayAdapter.js 10 Apr 2012 00:46:28 -0000 >@@ -21,6 +21,7 @@ > "exitConfirmation", > "focusControl", > "currentTheme", >+ "timeoutInterval", > "enableUiTests", > "activeKeys", > "cancelKeys" >Index: js/org/eclipse/rwt/ErrorHandler.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/js/org/eclipse/rwt/ErrorHandler.js,v >retrieving revision 1.13 >diff -u -r1.13 ErrorHandler.js >--- js/org/eclipse/rwt/ErrorHandler.js 7 Mar 2012 20:47:53 -0000 1.13 >+++ js/org/eclipse/rwt/ErrorHandler.js 10 Apr 2012 00:46:28 -0000 >@@ -8,7 +8,7 @@ > * Contributors: > * EclipseSource - initial API and implementation > ******************************************************************************/ >- >+ > /*global console: false */ > > qx.Class.define( "org.eclipse.rwt.ErrorHandler", { >@@ -53,30 +53,38 @@ > }, > > showErrorBox : function( content ) { >- var location = String( window.location ); >- var index = location.indexOf( "#" ); >- if( index != -1 ) { >- location = location.substring( 0, index ); >- } >- var hrefAttr = "href=\"" + location + "\""; >- var html = content.replace( /\{HREF_URL\}/, hrefAttr ); >- html = org.eclipse.rwt.protocol.EncodingUtil.replaceNewLines( html, "<br/>" ); >- this._freezeApplication(); >- this._createOverlay(); >- var element = this._createErrorBoxArea( 400, 100 ); >- element.innerHTML = html; >- var hyperlink = element.getElementsByTagName( "a" )[ 0 ]; >- hyperlink.style.outline = "none"; >- hyperlink.focus(); >+ //Assume it is a url; >+ if ( content.indexOf( "<html" ) > -1 ) { >+ var location = String( window.location ); >+ var index = location.indexOf( "#" ); >+ if ( index != -1 ) { >+ location = location.substring( 0, index ); >+ } >+ var hrefAttr = "href=\"" + location + "\""; >+ var html = content.replace( /\{HREF_URL\}/, hrefAttr ); >+ html = org.eclipse.rwt.protocol.EncodingUtil.replaceNewLines( html, "<br/>" ); >+ this._freezeApplication(); >+ this._createOverlay(); >+ var element = this._createErrorBoxArea( 400, 100 ); >+ element.innerHTML = html; >+ var hyperlink = element.getElementsByTagName( "a" )[ 0 ]; >+ hyperlink.style.outline = "none"; >+ hyperlink.focus(); >+ } >+ else { >+ //[ariddle] - HACK for IE: clear exit confirmation >+ org.eclipse.rwt.Display.getCurrent().setExitConfirmation(null); >+ window.location.href = content; >+ } > }, > > _gatherErrorInfo : function( error, script, currentRequest ) { > var info = []; > try { >- info.push( "Error: " + error + "\n" ); >- if( script ) { >- info.push( "Script: " + script ); >- } >+ info.push( "Error: " + error + "\n" ); >+ if( script ) { >+ info.push( "Script: " + script ); >+ } > if( error instanceof Error ) { > for( var key in error ) { // NOTE : does not work in webkit (no iteration) > info.push( key + ": " + error[ key ] ); >@@ -84,10 +92,10 @@ > if( error.stack ) { // ensures stack is printed in webkit, might be printed twice in gecko > info.push( "Stack: " + error.stack ); > } >- } >+ } > info.push( "Debug: " + qx.core.Variant.get( "qx.debug" ) ); > if( currentRequest ) { >- info.push( "Request: " + currentRequest.getData() ); >+ info.push( "Request: " + currentRequest.getData() ); > } > var inFlush = qx.ui.core.Widget._inFlushGlobalQueues; > if( inFlush ) { >@@ -181,4 +189,4 @@ > > } > >-} ); >+} ); >\ No newline at end of file >Index: js/org/eclipse/swt/Request.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/js/org/eclipse/swt/Request.js,v >retrieving revision 1.34 >diff -u -r1.34 Request.js >--- js/org/eclipse/swt/Request.js 7 Mar 2012 21:23:51 -0000 1.34 >+++ js/org/eclipse/swt/Request.js 10 Apr 2012 00:46:28 -0000 >@@ -39,6 +39,10 @@ > requestQueue.setMaxConcurrentRequests( 1 ); > // References the currently running request or null if no request is active > this._currentRequest = null; >+ //[ariddle] - added for inactive/timeout support >+ this._timeoutInterval = 0; >+ this._startTime = 0; >+ this._inactiveTimer = null; > }, > > destruct : function() { >@@ -76,6 +80,10 @@ > return this._requestCounter; > }, > >+ setTimeoutInterval : function( content ) { >+ this._timeoutInterval = content * 1000; >+ }, >+ > /** > * Adds a request parameter to this request with the given name and value > */ >@@ -118,7 +126,7 @@ > if( !this._inDelayedSend ) { > this._inDelayedSend = true; > var func = function() { >- this._sendImmediate( true ); >+ this._sendImmediate( true ); > }; > qx.client.Timer.once( func, this, 60 ); > } >@@ -181,8 +189,31 @@ > result.addEventListener( "sending", this._handleSending, this ); > result.addEventListener( "completed", this._handleCompleted, this ); > result.addEventListener( "failed", this._handleFailed, this ); >+ this._handleInactiveTimer(); > return result; > }, >+ >+ //[ariddle] - added for inactive/timeout support >+ _handleInactiveTimer : function () { >+ if ( this._inactiveTimer == null ) { >+ if ( this._timeoutInterval > 0 ) { >+ this._inactiveTimer = new qx.client.Timer( this._timeoutInterval ); >+ this._inactiveTimer.addEventListener( "interval", >+ function () { >+ org.eclipse.rwt.ErrorHandler.showTimeout( this._timeoutPage ); >+ }, >+ this >+ ); >+ this._inactiveTimer.start(); >+ } >+ } >+ else { >+ this._inactiveTimer.stop(); >+ if ( this._timeoutInterval > 0 ) { >+ this._inactiveTimer.startWith( this._timeoutInterval ); >+ } >+ } >+ }, > > _sendStandalone : function( request ) { > // TODO [rh] WORKAROUND >@@ -239,7 +270,7 @@ > org.eclipse.rwt.ErrorHandler.showErrorBox( messageObject.meta.message ); > } else { > org.eclipse.rwt.ErrorHandler.showErrorPage( text ); >- } >+ } > } else { > var statusCode = String( evt.getStatusCode() ); > text = "<p>Request failed.</p><pre>HTTP Status Code: " + statusCode + "</pre>"; >@@ -253,22 +284,22 @@ > _handleCompleted : function( evt ) { > var exchange = evt.getTarget(); > var text = exchange.getImplementation().getRequest().responseText; >- var errorOccured = false; >- try { >+ var errorOccured = false; >+ try { > var messageObject = JSON.parse( text ); >- org.eclipse.swt.EventUtil.setSuspended( true ); >- org.eclipse.rwt.protocol.Processor.processMessage( messageObject ); >- org.eclipse.swt.EventUtil.setSuspended( false ); >- org.eclipse.rwt.UICallBack.getInstance().sendUICallBackRequest(); >- } catch( ex ) { >- org.eclipse.rwt.ErrorHandler.processJavaScriptErrorInResponse( text, >- ex, >- this._currentRequest ); >- errorOccured = true; >- } >- if( !errorOccured ) { >- this._dispatchReceivedEvent(); >- } >+ org.eclipse.swt.EventUtil.setSuspended( true ); >+ org.eclipse.rwt.protocol.Processor.processMessage( messageObject ); >+ org.eclipse.swt.EventUtil.setSuspended( false ); >+ org.eclipse.rwt.UICallBack.getInstance().sendUICallBackRequest(); >+ } catch( ex ) { >+ org.eclipse.rwt.ErrorHandler.processJavaScriptErrorInResponse( text, >+ ex, >+ this._currentRequest ); >+ errorOccured = true; >+ } >+ if( !errorOccured ) { >+ this._dispatchReceivedEvent(); >+ } > this._runningRequestCount--; > this._hideWaitHint(); > // [if] Dispose only finished transport - see bug 301261, 317616 >@@ -316,7 +347,7 @@ > requestQueue._timer.start(); > } > }, >- >+ > _isConnectionError : qx.core.Variant.select( "qx.client", { > "mshtml" : function( statusCode ) { > // for a description of the IE status codes, see >Index: widgetkits/org/eclipse/swt/internal/widgets/displaykit/DisplayLCA.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/displaykit/DisplayLCA.java,v >retrieving revision 1.21 >diff -u -r1.21 DisplayLCA.java >--- widgetkits/org/eclipse/swt/internal/widgets/displaykit/DisplayLCA.java 7 Mar 2012 16:08:36 -0000 1.21 >+++ widgetkits/org/eclipse/swt/internal/widgets/displaykit/DisplayLCA.java 10 Apr 2012 00:46:28 -0000 >@@ -12,9 +12,13 @@ > package org.eclipse.swt.internal.widgets.displaykit; > > import java.io.IOException; >+import java.text.MessageFormat; >+ > import javax.servlet.http.HttpServletRequest; > >+import org.eclipse.rwt.RWT; > import org.eclipse.rwt.branding.AbstractBranding; >+import org.eclipse.rwt.internal.RWTMessages; > import org.eclipse.rwt.internal.application.RWTFactory; > import org.eclipse.rwt.internal.branding.BrandingUtil; > import org.eclipse.rwt.internal.lifecycle.DisplayUtil; >@@ -59,6 +63,7 @@ > static final String PROP_CURRENT_THEME = "currentTheme"; > static final String PROP_EXIT_CONFIRMATION = "exitConfirmation"; > static final String PROP_TIMEOUT_PAGE = "timeoutPage"; >+ static final String PROP_TIMEOUT_INTERVAL = "timeoutInterval"; > private static final String METHOD_BEEP = "beep"; > > private static final class RenderVisitor extends AllWidgetTreeVisitor { >@@ -132,6 +137,9 @@ > IWidgetAdapter adapter = DisplayUtil.getAdapter( display ); > adapter.preserve( PROP_FOCUS_CONTROL, display.getFocusControl() ); > adapter.preserve( PROP_CURRENT_THEME, ThemeUtil.getCurrentThemeId() ); >+ adapter.preserve( PROP_TIMEOUT_PAGE, getTimeoutPage( display ) ); >+ int maxInactiveInterval = RWT.getRequest().getSession().getMaxInactiveInterval(); >+ adapter.preserve( PROP_TIMEOUT_INTERVAL, Integer.valueOf( maxInactiveInterval ) ); > adapter.preserve( PROP_EXIT_CONFIRMATION, getExitConfirmation() ); > ActiveKeysUtil.preserveActiveKeys( display ); > ActiveKeysUtil.preserveCancelKeys( display ); >@@ -210,6 +218,26 @@ > } > } > >+ private static String getTimeoutPage(Display display) { >+ String timeoutPage = (String) display.getData( "org.eclipse.rap.rwt."+PROP_TIMEOUT_PAGE ); >+ if ( timeoutPage == null ) { >+ String timeoutTitle = RWTMessages.getMessage( "RWT_SessionTimeoutPageTitle" ); >+ String timeoutHeadline = RWTMessages.getMessage( "RWT_SessionTimeoutPageHeadline" ); >+ String pattern = RWTMessages.getMessage( "RWT_SessionTimeoutPageMessage" ); >+ Object[] arguments = new Object[]{ "<a {HREF_URL}>", "</a>" }; >+ String timeoutMessage = MessageFormat.format( pattern, arguments ); >+ // TODO Escape umlauts etc >+ timeoutPage = "<html><head><title>" >+ + timeoutTitle >+ + "</title></head><body><p>" >+ + timeoutHeadline >+ + "</p><p>" >+ + timeoutMessage >+ + "</p></body></html>"; >+ } >+ return timeoutPage; >+ } >+ > private static void renderExitConfirmation( Display display ) { > String exitConfirmation = getExitConfirmation(); > IWidgetAdapter adapter = DisplayUtil.getAdapter( display );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 376367
: 213782