1 Reply Latest reply on Apr 6, 2009 5:21 AM by SujitG

    Closing browser

    Mandeep_emc
      I am using Flex with WebORB and java servlet. On close of browser I capture the window unload event in Flex using ExternalInterface API to perform cleanup. As part of cleanup I invoke remote java method in servlet using Cairngorm. The java method in servlet is not getting invoked. Any ideas, why?
      WebORB is configured to startup with my servlet under Tomcat. I am using "GenericDestination" for remote method invocation.
      I invoke the java method in servlet "deleteAlertView" as shown below. I don't have any problems in remote invocation of methods in servlet from Flex console as long as I am logged in. The only issue is when I close the browser by clicking on the "X" button, capture the close event using ExternalInterface API, and then try to invoke the method. The Flex code shown below does get executed but I don't receive the call on the servlet side.

      public class DeleteAlertViewRemoteDelegate
      {
      private var _locator:ServiceLocator = ServiceLocator.getInstance();
      private var _service:RemoteObject;
      private var _responder:IResponder;

      public function DeleteAlertViewRemoteDelegate(responder:IResponder)
      {
      _service = _locator.getRemoteObject("alertLoaderRO");
      _responder = responder;
      }
      public function deleteAlertView(viewKey:ViewKey, all:Boolean):void
      {
      var token:AsyncToken = _service.deleteAlertView(viewKey, all);
      token.addResponder(_responder);
      }

      }
        • 1. Re: Closing browser
          SujitG Level 2

          Hi,

           

          The calls to the server might or might not be completed when invoked on browser window close. If I am correct this works in Mozilla and doesn't work in IE. You can probably try depending on the session of the Servlet container, try adding listeners to the session and do the necessary operation when the session times out.

           

          Hope this helps.