Thanks for your response, tsmiller.
Okay, I guess I had that wrong in the code. Not sure why there are
two flavors of Request methods, but I'll stick to qx.io.remote.Request
for now.
But unfortunately, it still doesn't work. I added a event handler for
the 'failed', 'aborted', and 'timeout' events, and sure enough, it
timed out. I'm not really sure why. Here is the request code now:
var req = new
qx.io.remote.Request("http://localhost:4242/getfeeds", "GET",
"text/plain");
req.setCrossDomain(true);
req.addListener("completed", function(e) {
composite.add(new qx.ui.basic.Label("getfeeds request
completed"));
alert(e.getContent());
});
req.addListener("receiving", function(e) {
composite.add(new qx.ui.basic.Label("getfeeds request
getting data"));
});
req.addListener("aborted", function(e) {
composite.add(new qx.ui.basic.Label("getfeeds request
aborted"));
});
req.addListener("timeout", function(e) {
composite.add(new qx.ui.basic.Label("getfeeds request
timed out"));
});
req.addListener("failed", function(e) {
composite.add(new qx.ui.basic.Label("getfeeds request
had an error"));
});
req.send();
I had set cross domain, because I'm working from the filesystem, and I
guess 'localhost' counts as a different domain.
So I get the timeout result, and I never even got the 'receiving'
event. why would that be? The server does send data.
-Matt
PS Here's a basic telnet session so you can see what the server is doing:
$ telnet localhost 4242
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /getfeeds HTTP/1.1
HTTP/1.1 200 OK
Content-Length: 1631
Date: Sun, 06 Sep 2009 22:41:49 GMT
Server: Hunchentoot 1.0.0
Content-Type: text/plain
[{"id":"afp","activep":true,"description":"Agence
France-Presse","permissions":["pull","icreate","isearch","stfsearch"],"compartments":["tac_authenticated"]},
... bunch of other JSON objects in this JSON array elided ...
]
On Fri, Sep 4, 2009 at 5:13 PM, tsmiller<[email protected]> wrote:
>
> Matt,
>
> qx.io.remote.Request and qx.io2.HttpRequest have different methods to get
> the returned data from the server. qx.io.remote.Request fires a "completed"
> event and qx.io2.HttpRequest fires a "load" event when the data is returned
> (as your code shows). However you use the e.getContent() with the former
> and you use req.getResponseText() or req.getResponseXml() to get your data
> with the latter.
>
> The following should work if everything else is ok.
>
> req.addListener("load", function(e) {
> //composite.add(new
> qx.ui.basic.Label(e.getContent()));
>
> composite.add(new
> qx.ui.basic.Label(req.getResponseText()));
> });
>
> see api documentation at
> http://demo.qooxdoo.org/current/apiviewer/#qx.io2.HttpRequest
>
>
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel