title: Session management in gwt
body: <p>I am using GWT for my client side application. However, I am not sure how I can handle session management. The GWT application resides on one page, all server calls are done via AJAX. If a session expires on the server. let's assume the user didn't close the browser, and sending some request to server using RPC, how could my server notify the application that the session has expired and that the client side portion should show the login screen again?My sample code :</p>
  
  <pre><code>ContactDataServiceAsync contactDataService = GWT
                  .create(ContactDataService.class);
          ((ServiceDefTarget) contactDataService).setServiceEntryPoint(GWT
                  .getModuleBaseURL()
                  + "contactDatas");
  
          contactDataService.getContact(2,
                  new AsyncCallback&lt;ContactData&gt;() {
                      public void onFailure(Throwable caught) {
                                        //code to show error if problem in connection or redirect  to login page
  
                      }
  
                      public void onSuccess(ContactData result) {
                          displayContact(result);
                      }
                  });
  </code></pre>
  
  <p>If session expires only it has to show login screen, otherwise it wants to show some error using Window.alert().</p>
  
  <p>How to do this and what are all the codes needed in server side and client side?</p>