2 Replies Latest reply on Jun 15, 2009 8:41 AM by dglidden-CE

    Download dynamically generated content (e.g. KML) as file?

    dglidden-CE Level 1

      Forgive me if this question has an obvious answer; so far I've come up with nothing.

       

      Here's my scenario:  A user has data in a form in my Flex app and wishes to export the data to a particular file type (let's use KML as an example) and let the browser handle the resulting file in whatever manner it typically does so (open in Google Earth, for instance).  The current flow is:

      • User enters data;
      • User clicks "Export to KML" button;
      • Flex validates the data and converts it to valid KML;
      • Flex executes an HTTP POST to a JSP with the KML data as the content;
      • The JSP echoes the data in the POST as the response data, setting the content-type as KML.

      This works fine, but I think I should be able to eliminate the JSP step.  However, I cannot find any way for Flex to directly handle setting up the HTTP response.

       

      Any suggestions?

       

      Thanks,

      Doug

        • 1. Re: Download dynamically generated content (e.g. KML) as file?
          Michael Borbor Level 4

          Use FileReference and target FP10

           

          Sincerely,

           

          Michael

           

          El 15/06/2009, a las 8:42, CarLuva <forums@adobe.com> escribió:

           

          >

          Forgive me if this question has an obvious answer; so far I've come 

          up with nothing.

          >

          Here's my scenario:  A user has data in a form in my Flex app and 

          wishes to export the data to a particular file type (let's use KML 

          as an example) and let the browser handle the resulting file in 

          whatever manner it typically does so (open in Google Earth, for 

          instance).  The current flow is:

          • User enters data;

          • User clicks "Export to KML" button;

          • Flex validates the data and converts it to valid KML;

          • Flex executes an HTTP POST to a JSP;

          • The JSP echoes the data in the POST as the response data with the 

          content-type for KML data.

          This works fine, but I think I should be able to eliminate the JSP 

          step.  However, I cannot find any way for Flex to directly handle 

          setting up the HTTP response.

          >

          Any suggestions?

          >

          Thanks,

          Doug

          >

          • 2. Re: Download dynamically generated content (e.g. KML) as file?
            dglidden-CE Level 1

            So:

            1. There's no way to do this targeting FP9?
            2. Can you explain how FileReference would accomplish this?  There is no file on the server that's being loaded, it's just dynamically generated content.  According to the documentation for FileReference, "The classes do not allow you to read from or write to the transferred file," so I'm not sure how I could use dynamically generated content instead of a static file with this class.

             

            Thanks for your time,

            Doug