Home » Eclipse Projects » Remote Application Platform (RAP) » Occasional Network Error popup
Occasional Network Error popup [message #1738470] |
Wed, 20 July 2016 03:17  |
Eclipse User |
|
|
|
Hi,
after deploying our RAP application on a remote Tomcat server we are encountering a strange behaviour:
sometime the application shows the popup "Network Error: the server seems to be temporary unavailable" (which, up to now, we have seen only when the server is down).
The server is indeed up an running and a click on Retry button allows the user to continue.
Is there a way to avoid or minimize this problem, e.g. some timeout setting to be raised or some override of RAP classes to skip the popup?
Thank you very much
Vincenzo
|
|
| | | | | | | |
Re: Occasional Network Error popup [message #1738737 is a reply to message #1738693] |
Fri, 22 July 2016 14:21   |
Eclipse User |
|
|
|
Wow, great!
Ok, we are perfectly aware that this is a bad practice, but risks are under control if balanced with finding a working solution.
And It works! but I was a little in a rush and was not precise.
Given that when the "Network popup" appears, it is sufficient to click on Retry button to get back to normal functionality, I would like to automate this.
So my original request to not showing the popup should indeed be reformulated in: "when the problem occours simulate a Retry action, ideally avoiding the popup, but not necessarily, since the Retry action just after should take care of closing it, maybe even whitout making the user aware of it".
Should I do something like this (I put your previous code in the unique Perspective class that I have, is it ok?)?
String script =
"(function() {"
+ " var origShowErrorBox= rwt.runtime.ErrorHandler.showErrorBox;"
+ " rwt.runtime.ErrorHandler.showErrorBox = function(errorType, freeze, errorDetails) {"
+ " if (errorType !== \"connection error\") {"
+ " origShowErrorBox(errorType, freeze, errorDetails);"
+ " } else {"
+ " rwt.remote.Connection.getInstance()._retry();"
+ " };"
+ " };"
+ "}());";
or
String script =
"(function() {"
+ " var origShowErrorBox= rwt.runtime.ErrorHandler.showErrorBox;"
+ " rwt.runtime.ErrorHandler.showErrorBox = function(errorType, freeze, errorDetails) {"
+ " if (errorType === \"connection error\") {"
+ " rwt.remote.Connection.getInstance()._retry();"
+ " };"
+ " };"
+ "}());";
?
|
|
| | |
Re: Occasional Network Error popup [message #1739040 is a reply to message #1739007] |
Wed, 27 July 2016 03:17   |
Eclipse User |
|
|
|
Hi Ivan,
thank you, I tried, but doesn't work.
But there is something more basic that I do not understand:
if I get it correctly (I am very poor at JS) from your very first snippet in this thread, this is a way to override the original method.
Assuming this, then this variant:
String script =
"(function() {"
+ " var origShowErrorBox=rwt.runtime.ErrorHandler.showErrorBox;"
+ " rwt.runtime.ErrorHandler.showErrorBox = function(errorType, freeze, errorDetails){"
+ " origShowErrorBox(errorType, freeze, errorDetails);"
+ " };"
+ "}()"
+ ");";
should have zero-effect, that is, should override the showErrorBox() method with itself unchanged.
Instead if I try this (just stopping the server and trying to continue to use the application) I see a different behaviour with or without executing this script: without executing a get a Network Error popup, while executing this I get no popup, just the application doesn't respond (which is normal since the server is stopped).
Shouldn't the behaviour be the same?
What am I missing?
Thank you
Vincenzo
|
|
|
Re: Occasional Network Error popup [message #1739043 is a reply to message #1739040] |
Wed, 27 July 2016 04:03   |
Eclipse User |
|
|
|
Hi Vincenzo,
here is a working Java function:
---
private static void patchClient() {
JavaScriptExecutor executor = RWT.getClient().getService(
JavaScriptExecutor.class );
StringBuilder builder = new StringBuilder();
builder.append( "(function() {" );
builder.append( " var errorHandler = rwt.runtime.ErrorHandler;" );
builder.append( " var origShowErrorBox = rwt.util.Functions.bind(
errorHandler.showErrorBox, errorHandler );" );
builder.append( " errorHandler.showErrorBox = function( errorType,
freeze, errorDetails ) {" );
builder.append( " if( errorType === \"connection error\" ) {" );
builder.append( " setTimeout( function() {");
builder.append( " rwt.remote.Connection.getInstance()._retry();" );
builder.append( " }, 100 );");
builder.append( " } else {");
builder.append( " origShowErrorBox( errorType, freeze,
errorDetails );");
builder.append( " }");
builder.append( " };" );
builder.append( "}() );" );
executor.execute( builder.toString() );
}
---
The "context" was not set when the original function is called.
HTH,
Ivan
On 7/27/2016 10:17, Vincenzo Caselli wrote:
> origShowErrorBox(errorType, freeze, errorDetails);
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| |
Goto Forum:
Current Time: Tue Jul 08 01:53:33 EDT 2025
Powered by FUDForum. Page generated in 0.61454 seconds
|