Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I suppose that for processing of incoming GWT call you use some Spring MVC controller or some servlet. It can have following logic </p> <pre><code>try{ // decode payload from GWT call com.google.gwt.user.server.rpc.RPC.decodeRequest(...) // get spring bean responsible for actual business logic Object bean = applicationContext.getBean(beanName); // execute business logic and encode response return RPC.invokeAndEncodeResponse(bean, ….) } catch (com.google.gwt.user.server.rpc.UnexpectedException ex) { // send unexpected exception to client return RPC.encodeResponseForFailure(..., new MyCustomUnexpectedException(), …) ; } </code></pre> <p>Solution for this case</p> <pre><code>HttpServletRequest request = getRequest() ; if (request.getRequestedSessionId() != null &amp;&amp; !request.isRequestedSessionIdValid()) { return RPC.encodeResponseForFailure(..., new MyCustomSessionExpiredException(), …) ; } else { // first code snippet goes here } </code></pre> <p>Then catch custom session expired exception in a client side code. If you do not use RPC directly then provide more details about your bridge implementation between GWT and Spring.</p> <p>You will need also force GWT compiler to include MyCustomSessionExpiredException type to a serialization white list (to prevent case when GWT security policy stops propogation of the exception to client side). Solution: include MyCustomSessionExpiredException type to each method signature of each synchronous interface:</p> <pre><code>@RemoteServiceRelativePath("productRpcService.rpc") public interface ProductRpcService extends RemoteService { List&lt;Product&gt; getAllProducts() throws ApplicationException; void removeProduct(Product product) throws ApplicationException; } MyCustomSessionExpiredException extends ApplicationException </code></pre> <p>Then show pop-up in client side code:</p> <pre><code>public class ApplicationUncaughtExceptionHandler implements GWT.UncaughtExceptionHandler { @Override public void onUncaughtException(Throwable caught) { if (caught instanceof MyCustomSessionExpiredException) { Window.alert("Session expired"); } } } // Inside of EntryPoint.onModuleLoad method GWT.setUncaughtExceptionHandler(new ApplicationUncaughtExceptionHandler()); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload