Hi Tristan,
I needed to add data to the request body of a PUT. In the current stable
version (1.6), the only way to do this is add keys to the "put" method, for
instance, req.put({data : "some data"}). Unfortunately this adds the key to
the request body as well like "data = some data" when what I needed was
just to add "some data" without the key.
I am aware of the "configureRequest" method but it won't work as is because
the "requestData" property of the request is overridden *after*
"configureRequest" is called. This happens in the invoke function:
invoke: function ( ... ) {
...
if (this.__configureRequestCallback) {
this.__configureRequestCallback.call(this, req, action, params);
}
this.__configureRequest(req, data, action, config);
...
}
All I did in the mixin was swap the above two lines, so I can now call
"req.setRequestData" in "configureRequest".
I didn't submit an enhancement request because in a previous email you
mentioned that the functionality I needed was already in master.
May i also suggest that you move the code that parses out a template string
and splices in place of the placeholder into it's own publicly accessible
class? Currently the functionality sits in "__placeholdersFromUrl" but has
use cases outside of "Resource.js" (for example, in other server requests
like qx.io.remote.Request and maybe as a convenient "printf" like thing).
-deech
On Fri, Jan 13, 2012 at 1:53 AM, Tristan Koch <[email protected]> wrote:
> Hi,
>
> btw, are you aware of qx.io.rest.Resource#configureRequest?
>
> > doSomeMoreStuff();
>
> Can you perhaps share what kind of "more stuff" you're doing? That would
> be very helpful.
>
> Also, as Thomas mentioned, please feel free to open an enhancement bug. It
> should be easy to sub-class and enhance rest.Resource. If there is anything
> stopping you from doing just that, we really should take a closer look if
> there is a better way to arrange the class.
>
> Regards
> Tristan
>
> Am 12.01.2012 um 18:28 schrieb aditya siram:
>
> > Hi all,
> > I had a mixin issue that I'd been battling for the past couple of days
> and fixed it but wanted to post the solution.
> >
> > The problem was that I needed to patch the "qx.io.rest.Resource" class
> and with a new "invoke(...)" method. In my "source" application everything
> worked fine and the mixin's method was used with no problem. In the "build"
> version I kept getting an error saying that my mixin was undefined.
> >
> > The original "invoke" method looks something like:
> > invoke : function ( ... ) {
> > ...
> > this.__createRequest();
> > ...
> > }
> >
> > And my mixin method looked like:
> > invoke : function ( ... ) {
> > ...
> > this.__createRequest();
> > doSomeMoreStuff();
> > ...
> > }
> >
> >
> > The reason this is happening is that the "__createRequest" method in
> "qx.io.rest.Resource" gets mangled before the mixin patches the class and
> so the "this.__createRequest()" call in the mixin is "undefined".
> >
> > The stop-gap solution is to turn off private method name-mangling in my
> config.json like so :
> > "let" :{
> > ...
> > /* disable "privates" optimization in build version due to current
> issues */
> > "OPTIMIZE" : ["variables", "basecalls", "strings"],
> > ...
> > }
> >
> > I think this is a bug in the "build" job because I would expect the
> mixin to patch the class before name-mangling.
> >
> > -deech
> >
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > RSA(R) Conference 2012
> > Mar 27 - Feb 2
> > Save $400 by Jan. 27
> > Register now!
> >
> http://p.sf.net/sfu/rsa-sfdev2dev2_______________________________________________
> > qooxdoo-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel