I am quite sure that only being able to use a request object once is a limitation of most browsers.
Also Jim I think you have got your terminolgy confused, Request objects aren't singletons. A singleton means you can only have one instance of that of object at any one time and you usually create them with .getInstance() rather than using 'new'. Jim Hunter wrote: > For one, a Request object is a singleton. By definition it can only be > used once. I assume they decided to make it a singleton because the life > of a Request is not clear cut. At any point in time you are not fully > sure if it is done doing it's job so that it can be used again. It was > easier to make it a singleton to reduce the amount of housekeeping code > needed to manage when it was done and could be used again. And I'm sure > the fact that it is asynchronous has a lot to due with it being a > singleton. > > Once you get over the fact that is can only be used once, and code > accordingly, you will find it's not that big of a deal. > > Jim > > > > On Wed, Jun 17, 2009 at 2:29 PM, aditya siram <[email protected] > <mailto:[email protected]>> wrote: > > Hi all, > It seems as though 'Request' objects can only be used once. Code > that tries to reuse [1] will only send the request once. Even though > I 'setData' on each button press subsequent sends do nothing. > Additionally the "completed" listener also only fires the first time. > > This is somewhat counter-intuitive and it took me a while to figure > out that both the request and listener have to be freshly made [2] > with each button press. Is this the intended usage? > > thanks ... > deech > > > > [1] > var req = new qx.io.remote.Request("/library", "POST"); > > button.addListener("execute", function(e) { > req.setData("isbn=" + isbn.getValue()); > this.debug(req.getData()); > req.send(); > }); > > req.addListener("completed", function(e) { > resp = qx.util.Json.parseQx(e.getContent()); > this.debug("done"); > this.debug(resp); > }); > > [2] > button.addListener("execute", function(e) { > var req = new qx.io.remote.Request("/library", "POST"); > req.setData("isbn=" + isbn.getValue()); > this.debug(req.getData()); > req.send(); > > req.addListener("completed", function(e) { > resp = qx.util.Json.parseQx(e.getContent()); > this.debug("done"); > this.debug(resp); > }); > }); > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing 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] > <mailto:[email protected]> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing 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 ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing 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
