java - How to Call a GWT method whenever an Async RPC is Made -
I have a website that uses GWT which is safe with the time of spring ... let's talk an hour Are there. As part of the process, I'm trying to apply client-side session timeout warning to 5 minutes before the end of the session.
I have JavaScript written, which uses cookies. The timer works to set the timer initially, and there is a method to reset the timer which can be used through the native methods in GWT.
Function Reset session timeout () {// Update cookie for updates Timeout var date = New date (); Var Timeout Time = 55 * 60 * 1000; Date.SetTime (date.getTime (+ timeouttime); Make cookie ('timeout', date.getTime (), 1); } Whenever an RPC server is performed, the server-based session timeout is refreshed, so the initial timer is no longer accurate after using any async call. The above mentioned activity will update the client side with the correct time expiration time.
The option that definitely works is to call the natives who call $ wnd.resetSessionTimeout () to I have an asynchronous call With each and every method , however, it is in many ways, and poor performance and bad smells of poor implementation.
Whenever an RPC has been created and received, then one way to set up the client part to see me is to put the original zero inside the MVP level instead of every method, ie What are the RPC supervisors or listeners there?
You can do something like this:
public class MyCallback & Lt; T & gt; Asynchronous callback applies & lt; T & gt; Public override (T result) on public microback () {} failure Show standard error message You can override it with an extra special message * where required * Override (t result) {executed (result); // Call your timer, etc.} Execute secure zeroes (t result) {// override while calling this method}} You now have all the AsyncCallback objects with MyCallback As an added bonus you will not have to override the failure every time, unless you want a specific error message.
Comments
Post a Comment