Flex Mobile, URLLoader and Sessions

I have created a Flex Mobile Project that I've been testing so far on a Motorola Xoom and uses the URLLoader object to query some JSP pages and return the output. These JSP pages require user authentication which depend on sessions.
If my URLLoader requests are made sequentially (the second request is not made until the first is completed) session information functions normally. If multiple URLLoader requests are made at the same time there is a chance that one or more of the request's session information will fail. I've used a packet sniffer and found that the "Cookie: JSESSION=..." header value is not being set or sent to the server.
I've actually been able to solve this problem by fetching my session ID when I login, storing it locally and setting the "Cookie: JSESSION=..." value manually in the header of all my URLLoader requests. Most of the time the browser will overwrite this value that I've set with the session ID that it has, and that's fine. But in the case where it doesn't set this value then my manually set value is passed to the server and it is able to find the appropriate session.
The solution I've come up with seems to work so far, but I was still wondering if anybody knows what's causing this or knows a better solution?

That sounds like everything's working the way it should. Until the "first" request is authenticated successfully and the response comes back to the browser/device, your app doesn't have session credentials. Sending multiple simultaneous unauthenticated requests will thus all need to authenticate individually -- and making matters worse, may create multiple sessions on the server, so as they come back your session info (as represented by your JSESSION ids) will rapidly run through all the new sessions until settling on the last one.
I would suggest changing your application flow to let your first request go by itself first and not submit any other requests until that (authenticated) response is received.
-- Tom
Flex SDK engineer

Similar Messages

  • Flex Mobile : URLLoader bytesTotal always at 0 when loading file

    Hi !
    I'm trying to load external file with UrlLoader in a Flex Mobile Project ( Initialy it was with Data/Services Options of Flash Builder, but I have the same problem ). On the complete event, it work on the desktop ( bytesTotal, xml... ), but when i install my application on my nexus one ( air version : 2.5.0.1660 ), i've no data ( bytesTotal = 0 ), but the cache of the application has grown
    The application has these autorisations :
                <uses-permission android:name="android.permission.INTERNET"/>
                <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
                <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    If someone can help me...
    Thx !
    Vince

    After messing with the URLLoader for a native windows AIR app I gave up on it. That object will return 200, ok, complete, while failing to do what it says it did.
    I never found any way to catch a real error from the server with any of the event listeners for URLLoader.  Instead I used HTTPService, it acutally returns useful data on server errors.  Here is an example, all this is tucked into my own class.
    var service:HTTPService = new HTTPService();
                   service.url = url;
                   service.resultFormat = HTTPService.RESULT_FORMAT_E4X;
                   service.method = URLRequestMethod.POST;
                   service.addEventListener(ResultEvent.RESULT,serviceResult);
                   service.addEventListener(FaultEvent.FAULT,faultResult);
                   service.send(vars);
    private function serviceResult(eResult:ResultEvent):void
                   var objResult:Object = eResult;              
                   if( objResult.result is XML )
                        xmlData = eResult.result as XML;
                        trace(xmlData);
                        dispatchEvent( new Event('eComplete') );
                   else
                        //something wrong
                        trace('BAD! No XML Returned: '+eResult.result);
                        dispatchEvent( new Event('eError') );
    private function faultResult(e:Event):void
                   if( e is ErrorEvent )
                        trace( ErrorEvent(e).text );                   
                   else if ( e is FaultEvent )
                        trace( FaultEvent(e).message.toString() );
                   else
                        trace( 'Unhandled error' );
                   dispatchEvent( new Event('eError') );

  • Flex Mobile - Alert and Information Popup Boxes

    Since a Android-looking popup box doesn't yet exist in the Hero SDK, I thought I would put a pretty good looking component together.
    You can download it (and the sample code) here:
    http://www.digitalretro.tv/components/InformationBoxTest.fxp
    A real simple example in in the project, for both an Info and an Alert.
    I currently only support an "OK" button, but I will be adding a Yes/No and OK/Cancel later this week.
    Hopefully this will save someone some time.
    Enjoy and feel free to use this in your code (commercial or non-commercial), just leave the copyright code in the component source file in place.
    Thanks.
    Darren

    Hi.
    I tried the Messagebox and it works great but is it possible to use a TextInput with it?
    I added a Textinput and when i enter the Textinput i got an Focusmanager is null error:
    private function touchMouseDownHandler(event:MouseEvent):void
             isMouseDown = true;
             mouseDownTarget = event.target as InteractiveObject;
             // If we already have focus, make sure to open soft keyboard
             // on mouse up
           if (focusManager.getFocus() == this)
                 delaySetFocus = true;
             // Wait for a mouseUp somewhere
             systemManager.getSandboxRoot().addEventListener(
                 MouseEvent.MOUSE_UP, touchMouseUpHandler, false, 0, true);
             systemManager.getSandboxRoot().addEventListener(
                 SandboxMouseEvent.MOUSE_UP_SOMEWHERE, touchMouseUpHandler, false, 0, true);
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at spark.components.supportClasses::SkinnableTextBase/touchMouseDownHandler()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableTextBase.as:2140]
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.managers::SystemManager/mouseEventHandler()[E:\dev\hero_private\frameworks\projects\framework\src\mx\managers\SystemManager.as:2924]
    Does anyone tried to use a TextInput or Textarea?
    I think it's the a problem with the Keyboard. Does mobile air can't use the "Android" Keyboard in Popup's?

  • Flex mobile orientation: force portrait mode and then allow auto orientation

    I'm creating a flex mobile project and I want to force the app to portrait orientation when I click a button, and when I click other button allow again to change the orientation.
    This is my code when I click the first button, where I want to force portrait mode:
    protected function click(event:MouseEvent):void{      if(stage.orientation != StageOrientation.DEFAULT){           stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged);           stage.setOrientation(StageOrientation.DEFAULT);      }else{           doSomething();      }  }  
    private function orientationChanged(event:StageOrientationEvent):void{      doSomething();      stage.removeEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged); } 
    private function doSomething():void{      stage.autoOrients = false; }
    It works ok and it changes the orientation if it's needed.
    Now, when I want to allow orientation change again, I've only putted:
    stage.autoOrients = true;
    It works ok if when I click the first button the app is in portrait and it doesn't have to change anything. But if it's on landscape and it have to change to portrait, when I allow orientation change again, it doesn't work ok.
    Do you know if I have to allow or change something? Or, is there any better way to do this?
    Thanks in advance

    Thanks for your answer. It works, but I have the same problem that I have setting the orientation. If I'm on landscape, it changes to Portrait ok, but when I want to allow auto orientation again, it doesn't work well.
    A little tricky I've found is:
    When I want to force to portrait:
    private var oldOrientation:String = null;
    protected function click(event:MouseEvent):void{
       if(stage.orientation != StageOrientation.DEFAULT){
                oldOrientation = stage.orientation;
                stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged);
                stage.setOrientation(StageOrientation.DEFAULT);
       }else{
                doSomething();
    private function orientationChanged(event:StageOrientationEvent):void{
                // do something if you are changing to portrait mode (the first change) and other thing if you are changing to old orientation
    And when I want to allow auto orientation again:
    if(oldOrientation != null){
            stage.setOrientation(oldOrientation);
            oldOrientation = null;             

  • ANE for one platform on Flex mobile project for iOS and Android

    I'm very new at Flex Mobile Projects and native extension.
    I have a big doubt... If I have an ANE that only works on iOS or Android, can I use it into a project for Android AND iOS?
    I mean, if I want to do something and I've only found and ANE that works for iOS and another ANE that works for Android, can I create only one project and depending on the device use one or another? or should I create two different projects?
    Thanks in advance

    You can set them both up and when you publish just comment out the code that does not apply, this way you still keep it as one project but you can use the ANEs as needed, I had to do this with the iAd ANE only for Apple obviously and AdMob ANE which at the time was Android only.
    Example
    //Android ANE Code
    blah blah blah
    //iOS Code
    code code code
    Now when you publish for iOS comment out the Android related stuff
    //Android ANE Code
    blah blah blah
    //iOS Code
    code code code
    Also dont forget to update your included ANEs when you publish and remove the ones that dont apply and update the XML files as needed. Its possible, but annoying, it would be nice if it was automated or could be flagged somehow so the Flash publisher would auto ignore it.

  • Flex mobile app attach complex AS3 movieclip SWC

    I have a Flex mobile project and I want to place a complex movieclip on the stage that has its own classes and exported from Flash CS5.5 as a SWC.
    OK no worries there but as soon as I have addChild called in the Flash movieclip/SWC.. Flex errors and cannot access null object reference.
    I also went down the Flex Component Kit though then I can't seem to access the classes??
    Any thoughts or suggestions appreciated.

    Did you ever find a solution?

  • Incompatible signature after creating a new Flex mobile project in Flashbuilder 4.6

    When I create a new flex mobile project and try to build it right away it gives me this error
    1144: Interface method initialize in namespace mx.core:IUIComponent is implemented with an incompatible signature in class utest.
    I have tried reinstalling Flash Builder and even upgraded from 4.5 to 4.6 to try and resolve this problem.
    I have also tried using different versions of the Adobe Air sdk (I'm currently using Air 3.4).
    Here is the projects mxml file, if that helps although it doesnt have anything but the generated code.
    utest.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                firstView="views.utestHomeView" applicationDPI="160">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
    </s:ViewNavigatorApplication>
    views.utestHomeView.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
    </s:View>
    Also I am running Flash Builder 4.6 on Windows 7 32-bit
    Thanks in advance for the help
    Edit:
    I have now tried the flash builder 4.7 trial and even 4.6 on a different machine, both were clean installs, and I have found that when i create a new project it does compile
    until I get an error, and this can be any error, then after I fix that error it gives me the same error as before
    1144: Interface method initialize in namespace mx.core:IUIComponent is implemented with an incompatible signature in class utest.

    Hi Gsaison,
    Do you have any progress on these issues? Im working on the same solution right now (SWV + GoogleMaps JS v3 ) I've got some weird issue when i try to spawn a StageWebView inside a View on IOS, it appears inside a scroller and is not open for finger interaction anymore. I use the eskimo framework, but then again, nothing fancy going on there for the rest. I've tried all of the the stage.stageScaleMode options but non of them work. Got any help?
    Kind regards,
    Roy

  • Open PDF file into flex mobile app

    Hy,
    I use this method to open a web page into my flex mobile application and I want to now if is possible to make the same for an PDF file.
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="Test">   <fx:Script> <![CDATA[ import flash.net.URLRequest; import flash.net.navigateToURL; import flash.display.MovieClip; import flash.media.StageWebView; import flash.geom.Rectangle; import flash.events.KeyboardEvent; import flash.ui.Keyboard; import flash.desktop.NativeApplication; import mx.events.FlexEvent; private var browser:StageWebView;
    protected function onButtonClicked(event:MouseEvent):void { browser = new StageWebView(); browser.viewPort = new Rectangle(0, 0, 100, 200); browser.stage = this.stage; browser.loadURL("http://adobe.com"); }  ]]> </fx:Script> <s:Button x="209" y="67" label="test" click="onButtonClicked(event)" /></s:View>

    Rangrajan,
    If you have the complete URL to the file; for example http://forums.adobe.com/filename.pdf
    or C:\users\yourname\filename.pdf
    Although I have not used it, you can pass the URL to Drumbeat Insight iFrame
    You can try their product, get prices for source code or library here: http://drumbeatinsight.com/products
    They offer email support for their products.
    You can make your own iFrame, with several sources.  Here is some background.
    http://www.ozzu.com/flash-forum/targeting-iframe-from-flash-t30013.html
    Let me know if this solves your file issue.
    I need to write a server-side app to listen to my web service, upload the PDF, then write a temporary file.pdf to the server,
    before my web app can load the PDF into a web hosted iFrame.
    Adobe needs to make this easy (and I even know some developers in the San Jose Adobe headquarters).
    Bruce

  • Flex Mobile 4.5.1: Package contents and URLLoader

    On Flash for web and desktop (Projector debugger), one can use a URLLoader to load local URLs (eg files off your hard drive).  This is very useful for some development purposes, as you just need to make sure any external files (JSON & PNG) are in the same relative path as the SWF, and you then don't need to worry about different code paths whether you're loading these external files from local storage or http.  URLLoader operates the same whether loading locally or remotely.
    Is there any way to easily get the same behavior on a Flex Mobile 4.5.1 app (specifically for an iOS target)?  Again, this is useful because in my live app, these external files will be loaded from our web server, but for testing purposes I would like to be able to run in a server-less mode and include them with the deployed debug IPA file.  My first problem is that I cannot seem to figure out how to deploy these files to the application in the first place - I tried adding my external-files folder to the Flex Build Path as an additional Source folder, but they still don't show up under the Package Contents for iOS tab.
    Any ideas?  Are there any include-extra-files-in-package options in the -app.xml? 
    Or is there no way to use URLLoader for local storage on mobile, and I am stuck with using Embed?  (I guess besides Embed I could manually deploy the files to the iOS file system and use the AIR api for access, but that's still a different code path, defeating my goal - we have a decent bit of code built around the idea that URLLoader is agnostic)

    Edit: Realized my original answer wasn't correct, the files were being pulled in from another setting.
    After some experimenting, the answer is YES, and it's actually a bit unexpected: Just in fact adding the external files folder to the Flex Build path | Source Path actually pulls them all in.  It seems those directories are passed to both mxmlc and adt.  Unexpected surprise.

  • Flex mobile project: web root and root path for a remote web service?

    Hi all,
    i'm trying to set up the testdrive tutorial for flex mobile project, with flash builder 4.5
    and php data.
    I've uploaded the files on my remote web space (e.g. http://mywebsite.org, and the
    test file is http://mywebsite.org/TestDrive/test/test.php... and it works
    correctly)... But when i'm setting properties of the project, i don't know what
    to write into the web root and root path fields... I thing root path is simply
    http://mywebsite.org... and whatever i write in the other fields (output folder
    too) i have errors when i click on "validate configuration"...
    What should i put into those fields? is zend framework (and gateway.php)
    strictly necessary?
    As you can see... i'm a bit confused....
    Many thanks for any help
    Bye
    Alex

    I thought it was a simple question...
    No advice?

  • Flex mobile project standalone flex server resets to J2EE and can not change

    Developing an Android mobile project with FB 4.5. Set original project-->properties-->flex server to standalone with coldfusion as server.  After setting web root, Root URL and Coldfusion root folder app works fine with CF. Sometime during development, flex server gets set to J2EE and CF access halts.  Go back into project-->properties-->flex server and reset server to 'standalone' with original settings.  click Apply or OK and assume that it is reset but it does not.  Go back into flex server settings and it is still J2EE.  I have seen this issue before and can not resolve it or find any other threads where there is a resolution to this.  My only way to continue is to start a new mobile project, import the files and continue.  This is not an acceptable way to design any mobile project!!  HELP!!

    Developing an Android mobile project with FB 4.5. Set original project-->properties-->flex server to standalone with coldfusion as server.  After setting web root, Root URL and Coldfusion root folder app works fine with CF. Sometime during development, flex server gets set to J2EE and CF access halts.  Go back into project-->properties-->flex server and reset server to 'standalone' with original settings.  click Apply or OK and assume that it is reset but it does not.  Go back into flex server settings and it is still J2EE.  I have seen this issue before and can not resolve it or find any other threads where there is a resolution to this.  My only way to continue is to start a new mobile project, import the files and continue.  This is not an acceptable way to design any mobile project!!  HELP!!

  • How to display html content with image in Adobe Flash and Flex mobile project?

    Hi,
      I have a html content with image in it. How to display it in Adobe Flash Builder and Flex mobile project? Which control needs to be used for this?

    Hello,
    The only current way is to use an iFrame, or if you only need some html tags you could use the Text Layout Framework.
    Here this is the iFrame approach:
    http://code.google.com/p/flex-iframe/
    If the swc do not work in Flex4 just use its ource code which works...
    ...it is basically based on this:
    http://www.deitte.com/archives/2008/07/dont_use_iframe.htm
    see also and vote, please:
    http://bugs.adobe.com/jira/browse/SDK-12291
    http://bugs.adobe.com/jira/browse/SDK-13740
    Regards
    Marc

  • IOS universal support and ASC 2.0. Will it impact Flex Mobile projects?

    Hello,
    Regarding the latest release notes for AIR 16, it says
    "The legacy compiler is not (and will not be) compatible with iOS 64-bit.[...] it will be removed with version 16 of the AIR SDK"
    I am a bit lost with what it means for Flex Mobile (4.6 or Apache Flex SDK). Will we still be able to compile once AIR 16 is out or will this new compiler have issue with Flex projects compiled for iOS? Will it need us to make some changes on existing Flex applications?
    Thanks for your clarifications,
    Fabien

    It seems this wrong rumour is spreading around... a lot of people don't bother researching properly.
    When they talk about the legacy compiler they talk about ADT, MXMLC will continue to work. The simplified IPA packaging process is: Source code --- MXMLC/ASC2---> SWF ---ADT AOT Compiler---> IPA
    So with AIR 16 the ADT -useLegacyAOT argument will be removed.

  • Flex mobile and PHP project

    Hi! Recently I've downloaded the Flash Builder for PHP to work with my Zend Server remotely located in OpenShift online. I did not  download and install the Zend Server physically on  my computer. Hence, when creating the Flex mobile and PHP project, I couldn't find my web root address. Now I have an error connecting to the MySQl database in the server from the Flash Builder. Can someone help me with this? I'm new to using these programs.
    I'm following this guide on building mobile apps:
    http://files.zend.com/help/Flash-Builder-for-PHP/Getting-Started/Mobile/build_a_mobile_(ph p)_application.htm#Step_13:_Preview_the_Mobile_Application_Using_the_Desktop_Emulator

    PHP is server side.
    If you want to have a app to function offline you would probably need sqlite and then code actionscript to synch data when the device regains it's connectivity.

  • Flex mobile support drag and drop

    According to Adobe's "Developing Mobile Applications in Flex" document it doesn't. But I was wondering if that applies to both mobile phones and tablets, or only to mobile phones. Can this feature be added manually through ActionScript 3?
    Thanks, Norman

    Here's a hack that you might be able to make work for you...
    http://flexponential.com/2011/06/21/using-drag-and-drop-with-a-spark-list-in-a-mobile-flex -application/

Maybe you are looking for

  • Problem in using JScrollPane

    hiii i am creating an image editor in java... here is my code for using scrollpane   contentpane = getContentPane();             view  =  new JLabel(new ImageIcon(bufferedImage));             scrollpane =  new JScrollPane(view,ScrollPaneConstants.VER

  • Display Issues + error connecting​? Yoga 13

    Hey, I just sent my laptop in to get repaired after it fell on the ground at a laundromat and the screen shattered, $300 later and two months after, I'm finally using it again, but I've been only using it for about two weeks, and a few days ago I not

  • How to write it in ABAP?

    I wish to delete all those records from my internal table where bktxt <> 'UP' or 'up'. How will I write it in ABAP? pls suggest. Regards, Alok.

  • MacBook Pro 13,3 and 15,4 : graphic memory

    I would like to buy a MacBook Pro but I'm worried about the graphic memory. On the MacBook Pro 13,3 tech specs I can read: "NVIDIA GeForce 320M graphics processor with 256MB of DDR3 SDRAM shared with main memory" Shared? Does this mean that the video

  • PROXY. What optimisations are there?

    We have a fairly big installation of proxies and masters which I am testing at the moment. Using SLAMD. On a simple LDAP Auth test, I am seeing results that look like the following: LDAP client -> Proxy -> Master. 600ms+ when handling only 125 auths/