Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-23686

When Flex program communicates with multiple Struts servers, JSESSIONID is not correctly passed to 2nd and subsequent servers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Adobe Flex SDK Previous
    • None
    • RPC: HTTPService
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Browser: Firefox 3.x
      Language Found: English

    Description

      PLEASE SHOW OR ASSIGN THIS TO aglosban who was working on BLZ-375 and asked me to submit this!

      I am running a SWF file (call it the parent) that establishes communication with a Struts server and makes at least 2 calls to that server. Then, a state is entered in the parent application by using a SWFLoader, inside the parent application, which invokes another application (call it the nested application).

      Steps to reproduce:

      1. The parent SWF makes a call to a Struts server and after the first such call, a JSESSIONID is sent back as a cookie and the ActionScript implementation remembers this JSESSIONID and uses it on subsequent calls in the parent. At least one such subsequent call is made before step 2.

      2. The parent enters a state that contains a SWFLoader to a another application that establishes communication with a different Struts server application, the nested application. Note that during the first call to the nested app's Struts server, everything works fine since there is no JSESSIONID for the nested app yet. The nested app's Struts server sends back a new JSESSIONID after that first call, expecting it to be remembered for subsequent calls.

      3. On the second and subsequent calls from the nested app (SWF) to its Struts server, Flex fails to correctly remember and send the JSESSIONID for the nested application. Therefore, the Struts server cannot establish client context for the call. Struts assumes this is a new client and so its starts a new session, assigning it a new JSESSIONID. It sends back this new JSESSIONID to the client. Alas, that new JSESSIONID isn't remembered on subsequent calls from the nested application, either. So the nested application cannot communicate with the nested Struts server.

      Additional Details:

      The MXML for invoking the subapplication inside my parent looks like this:

      <!-- Form for state RunApp -->
      <mx:Form id="mainForm" width="800" height="800" >
      <mx:FormHeading label="Run PurchaseOrder" />
      <mx:FormItem label="POApp" labelStyleName="standardLabel" width="100%" height="100%" >
      <mx:SWFLoader id="loader1"
      trustContent="true"
      source="

      {dasl_POApp}

      "
      init="addSubAppCompleteHandler(event);"
      width="100%" height="100%" />
      </mx:FormItem>
      </mx:Form>

      NOTE: The function addSubAppCompleteHandler() and related event code serves to store the callback URL for the subapplication's Struts server inside the subapplication SWF implementation. It is as follows:

      [Bindable] public var subAppMgr:SystemManager;
      [Bindable] public var subApp:Application;

      // Initialize variables with information from the loaded application.

      private function subAppCompleteHandler(event:Event):void {
      subApp = Application(event.target.application);
      var subAppUrl:String = subApp.url;
      Alert.show("rootURL from sub-app = " + SWFLoader(subApp)["ClientData"]["rootURL"]);
      }

      private function addSubAppCompleteHandler(event:Event):void {
      subApp = Application(event.target.application);
      var subAppUrl:String = subApp.url;
      subAppMgr = SystemManager(event.target.content);
      subAppMgr.addEventListener(FlexEvent.APPLICATION_COMPLETE,subAppCompleteHandler);
      }

      Actual Results: The JSESSIONID sent back from the nested Struts server after the first nested call is not remembered, so subsequent calls from the nested app do not pass it to the Struts server. I verified using Charles that although the GET from the nested app results in a server response with the JSESSIONID Cookie in it, the next call from the nested app to the server does not contain this Cookie.

      Expected Results: The JSESSIONID sent back from the nested Struts server after the first call should be remembered for subsequent calls. In addition, if for some reason (such as a session timeout) the nested Struts server passes back a different jSESSIONID after a call, that new JSESSIONID should be remembered for subsequent calls from the nested app to the nested Struts server.

      Workaround (if any):

      I have not been able to work around this problem. Through debugging, I am able to "see" the JSESSIONID coming back to the nested app by looking at the cookies in the response in the debugger. But I have not been able to get that JSESSIONID to be somehow remembered and sent to the Struts server on subsequent calls from the nested SWF code. I tried adding the JSESSIONID to the URL but that does not work – the Struts implementation seems to pay attention to the JSESSIONID in the URL only when cookies are disabled by the caller's browser, which is not the case.

      NOTE: Does not appear to be browser-specific. It occurs in Firefox, Safari, and IE. it seems to be a problem with the ActionScript runtime system.

      Attachments

        Activity

          People

            Unassigned Unassigned
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: