[Laszlo-dev] Rest Support

Henry Minsky henry.minsky at gmail.com
Sun Feb 24 08:15:33 PST 2008


I'm taking a look at this. Can you tell me if there is an easy way to  you
get Tomcat server to return a 401 code? If I mark
a file as unreadable, I am getting back a 404 code.

<canvas width="100%" height="80%" debug="true">
  <debug  fontsize="12"/>

  <dataset name="mydata" src="http:foo.xml"
           onerror="Debug.write('onerror', this.errorstring)"
           ondata="Debug.write('ondata', this.data)"
           request="true"/>


</canvas>


this returns the following in the debugger in swf8

 «LoadObj#0| err.lzx (loading)» «LzLoader#1| err.lzx (loading)»
ERROR: data source error for http://127.0.0.1:8080/trunk/test/post2/foo.xml:
HTTP Status code: 404:Not Found
onerror data source error for http://127.0.0.1:8080/trunk/test/post2/foo.xml:
HTTP Status code: 404:Not Found

lzx> mydata.errorstring
'data source error for http://127.0.0.1:8080/trunk/test/post2/foo.xml: HTTP
Status code: 404:Not Found'
lzx>



By the way, you won't be able to support full REST API transactions in
non-proxied mode in swf7/8 because the Flash player
does not let you specify PUT or DELETE request . These are supported by the
proxy server though, I am pretty
sure. If they aren't then it's a bug..

In DHTML, I believe PUT and DELETE request methods are supported in SOLO
mode.






On Sun, Feb 24, 2008 at 8:07 AM, Elias Khalil <elias.khalil at g.ho.st> wrote:

> I am trying to call REST APIs from openlaszlo. I tried to make a dataset
> http request and it worked fine on success. But in case where the REST
> returns an error like HTTP Error 401 – Unauthorized I can't read the error
> string or code. It behaves as the following:
> On proxied mode: dataset.getErrorString()always return null while in
> debugger there is a message showing the error type but we can't access it
> On non proxied mode: calling dataset.getErrorString() result in error
> "client could not parse XML from server"
> Using Xmlhttprequest is also not helpful where it always cast errors types
> to http error 500
>
> In order to support calling basic REST APIs, I need to get a clear HTTP
> Error code and also be able to read the http content in case of error.
>



-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080224/a990fa8c/attachment-0001.html


More information about the Laszlo-dev mailing list