[Laszlo-dev] Re: Ajax API and XML format
Don Dwoske
don at loraxis.com
Fri Oct 14 09:17:28 PDT 2005
>
> I added a "AJAX" compatibility library, which was really just a class
> which
> implements the XMLHttpRequest object that the browsers have. It is a thin
> wrapper around the regular Laszlo dataset API, and doesn't provide much if
> any additional features, it is just to make new Laszlo developers who come
> from DHTML development feel comfortable if they want to use the data API.
If indeed, your XMLHttpRequest object wraps the Laszlo dataset API, there
are some aspects of the implementation that will be confusing - and not work
properly in a SOLO deployment.
if (request.status == 200) {
> Debug.write("arg =", request);
> Debug.write("request.status", request.status);
> Debug.write("request.responseText:", request.responseText);
> Debug.write("request.responseXML:", request.responseXML);
> Debug.write("request.getAllResponseHeaders:",
> request.getAllResponseHeaders
In a SOLO deployment, several unexpected things happen here.
1. No response headers are available, so you get nothing
2. The 'status' is not what comes back from the server. If onData is
executed, a 200 status code is hardcoded. There are other successful codes
which can be sent by the HTTP protocol (such as 201 - Created)... you will
never get those in a SOLO app. There is also inconsistant behavior here
between some flash players, sometimes a 201 will call onData, sometimes it
calls onError... this is a Flash deficiency, not Laszlo.
3. Likewise, for error codes, in a SOLO app, a 500 response code is
hardcoded.. so if the server sends 401, 404, 501.. in a SOLO app - that's
not available, and you'll see a 500.
For most applications, this is not a problem, but when strictly using REST
services, it is... because those granular status codes have meaning, as well
as information inside the response headers (such as Location: for 201
codes).
These issues belong with the Flash player, and not with Laszlo, but they
should be mentioned anyway. Maybe with latest Flash players this has been
fixed, but I've not ready anything pertaining to those issues.
We talked before about using the new Flash 8 feature to actually call the
Browser version of XMLHttpRequest instead of wrapping the dataset..
"The new ActionScript/JavaScript API, which allows you to call JavaScript
functions from your ActionScript code and ActionScript from your JavaScript
code, and exposes innovative ways to combine HTML and even AJAX interfaces
with Flex interfaces"
http://www.macromedia.com/devnet/flex/articles/fp8_features.html
That would be fantastic because then all the response headers and status
codes *would* be available inside a SOLO app. (using Flash 8)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlaszlo.org/pipermail/laszlo-dev/attachments/20051014/4c5e6b67/attachment.html
More information about the Laszlo-dev
mailing list