On Mon, Apr 27, 2009 at 3:04 PM, Jean-Noël Rivasseau <[email protected]>wrote:
>
> Another question, I am currently directly executing JS code that the server
>>> generates. But if I were using serialized JSON, I am not too sure how it
>>> could work given that IE does not fire an event on a <script> element that
>>> gets loaded. How can you thus fire the "completed" event on such a request?
>>
>>
>> Script transport works by generating a call to a function:
>>
>> qx.io.remote.ScriptTransport._requestFinished(id, returnValue);
>>
>> This is a qooxdoo-specific enhancement that allows script transport to
>> work, and requires agreement between the server and the client (qooxdoo)
>> that the server will generate a response that calls this function. If your
>> requirements are different, you'll likely need to derive your own transport
>> class that knows how to deal with what your server wants to return.
>>
>
> Wait there... are you saying that in my generated JS code on the server I
> should call explicitely this function?? eg:
>
> console.log("Hello World");
> // Do some other stuff there
>
> qx.io.remote.transport.Script._requestFinished(id, returnValue);
>
> That would make sense, but this should then be included in the
> documentation, because there is nothing about this! This requires the server
> to adhere to some conventions that are not at all described in the
> documentation. What is id? What is returnValue?
>
If we documented it, more people would use Script Transport with all of its
nasty security implications, so leaving it undocumented lets us tell each of
you how nasty it really is to try to discourage you from using it. :-)
You're right. It could use some documentation someplace. I'm not sure where.
Probably in the Server Writer's Guide, but that's RPC-specific. Hmmm...
Fabian likes doing wiki edits. Maybe he'll find some nice appropriate place
for it.
Anyway, yes, the return value from your Script Transport server must be a
string containing a call to a javascript (qooxdoo) function:
qx.io.remote.transport.Script._requestFinished(). That function expects two
parameters. The first is the ID that was provided to the server by the
qooxdoo client in the GET request, parameter name "_ScriptTransport_id".
Passing this id back to the qooxdoo client allows qooxdoo to associate the
incoming response with the original request. The second parameter to the
function is the JSON object that you want returned to the client.
Derrell
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel