On Mon, Nov 15, 2010 at 09:03, Joffrey Fuhrer - NOVLOG <
[email protected]> wrote:
> On 15/11/2010 14:42, Derrell Lipman wrote:
>
> On Mon, Nov 15, 2010 at 07:59, Joffrey Fuhrer - NOVLOG <
> [email protected]> wrote:
>
>> In other words : we want to send a CSV file containing the information
>> gathered in a qooxdoo table.
>>
>> I've ended up choosing to use the Iframe class because with the
>> qx.io.remote.Request class as well as the qx.io.HttpRequest class,
>> the servlet response is "captured" by qooxdoo, while we want the
>> browser to process it as a file.
>>
>> Knowing this, is there anything in qooxdoo that could fit our needs
>> better than that?
>> If not, is there any guarantee that code written with this class
>> will be maintainable, or are we really in the qooxdoo jungle
>> there? =)
>>
>
> ...
> I don't understand what you mean by "the servlet response is "captured" by
> qooxdoo. And what does it mean for a browser to process something as a file?
> The responses to all requests by an application are returned to the
> application, and the application can do what it wants with them. If the
> response is CSV data, then it should be sent as text/plain and the browser
> can do with it what it will, right.
>
>
> By saying "process something as a file", what I really meant in this
> particular use-case is that I want the browser to trigger a download.
> The problem I encountered when trying to use qx.io.remote.Request was
> that the browser I used was never made aware of this CSV file I was
> sending back; and as I understand it, the content of this file was
> probably "captured" in the "Response" object - which is what I
> don't want because then I don't know how to output something as a
> file in JS : in fact, that is why we do a server call.
>
> So basically the idea is what I tried to summarize in the title of
> this thread : I want to trigger a file download from a qooxdoo app,
> using as much "qooxdoo magic" as possible, but without having my
> app put its hands on the server's response.
>
Hmmm... You don't want the app to put its hands on the response. So what do
you want to happen with that response? Do you want it displayed someplace?
You could create an Iframe and set the Iframe's src attribute so that the
file gets loaded into that Iframe, but if the file is a CSV file and not
HTML, it won't render properly. All of the newlines will become single
spaces, and the whole thing will end up on one messy line. If the CSV file
is preprocessed at the server to instead be HTML that displays
comma-separated values and then has a <br> tag, you'd get the proper
appearance, but it's no longer downloading a CSV file.
If the data needn't be displayed, then the former idea may actually work. If
the data is coming from the same origin as your application, you then, I
believe, have access to the Iframe's data (via innerHTML? I don't recall)
and can extract it. But you said you don't want the application involved, so
I still don't understand your goal here.
Derrell
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel