Hi, with configureRequest you can, but as you've written that’s not very elegant.
If you need the second parameter but want to avoid master, you could monkey patch your copy of qooxdoo. Here is the commit that introduced the new behavior: https://github.com/qooxdoo/qooxdoo/commit/3006cada36f7b928f62365c9e4b088d9c893eb1a Replacing the file is perhaps the easiest solution, but there are a lot of other approaches if you don't want to touch the framework code. The cleanest solution is probably to move the changed method (invoke) to a mixin and include this mixin with qx.Class#patch. Regards Tristan Am 11.01.2012 um 00:19 schrieb aditya siram: > Hi all, > I am trying to use the qx.io.rest.Resource class to "PUT" some data to the > server. The problem is that the only way I can currently (in qooxdoo 1.6) > attach a payload to the request is the add a parameter to the map like : > qx.io.rest.Resource.put({data : "hello world"}); > The problem is that I just want to add "hello world" to the request body raw > and not "data = hello world". > > The example below of using the master branch of qooxdoo shows how to do this, > but is there anyway to make this happen in 1.6? > > -deech > > On Wed, Jan 4, 2012 at 1:57 AM, Tristan Koch <[email protected]> wrote: > Hi Deech, > > by headers I assume you mean the request body? > > With qooxdoo 1.6, and if your server expects JSON, you can set the > Content-Type of the request’s body to "application/json" and provide the data > as part of the parameters hash. Parameters with placeholders associated end > up in the URL, the rest goes to the body and is encoded as JSON. > > If you are on master, we've just recently changed this behavior. For the > upcoming version of qooxdoo, a second argument can be provided that ends up > straight in the body. > > For example: > > res.map("put", "PUT", "/article/{id}"); > res.put({id: 1}, '{title: "Awesome title"}'); // JSON > res.put({id: 1}, {title: "Awesome title"}); // URL encoded, automatically > res.put({id: 1}, "title=Awesome%20title"); // URL encoded, manually > > For more details, see http://bugzilla.qooxdoo.org/show_bug.cgi?id=5996. > > Passing data to the description would only work for data that does not change > per request. If you have static data that should always be merged into the > URL parameters (or data parameters, for master), consider overriding invoke. > > Regards > Tristan > > Am 03.01.2012 um 23:13 schrieb aditya siram: > > > Hi all, > > I would like to attach data to a PUT request of qx.io.rest.Resource. The > > only way I can think to do this is using the configureRequest(...) function > > like : > > r.configureRequest(function(req, action) { ... req.setRequestData(...) > > ...}); > > just before calling qx.io.rest.Resource.put(); > > > > It would be more elegant if I could pass in my data into the map that is > > initially used to construct the qx.io.rest.Resource. Is there a way to do > > this? > > > > -deech > > ------------------------------------------------------------------------------ > > Write once. Port to many. > > Get the SDK and tools to simplify cross-platform app development. Create > > new or port existing apps to sell to consumers worldwide. Explore the > > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > > http://p.sf.net/sfu/intel-appdev_______________________________________________ > > qooxdoo-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > > ------------------------------------------------------------------------------ > Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex > infrastructure or vast IT resources to deliver seamless, secure access to > virtual desktops. With this all-in-one solution, easily deploy virtual > desktops for less than the cost of PCs and save 60% on VDI infrastructure > costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev_______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
