Rest

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Rest

Frédéric
Hi!

Is there a way to retreive the timestamp sent by the serveur in its
response when using Rest com., through qx.io.rest.Resource?

--
    Frédéric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Frédéric
Another question about Rest: how can I send params with a 'long poll'
request ?

--
    Frédéric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Daniel Wagner
Administrator
In reply to this post by Frédéric
By timestamp do you mean a response header? You can get those from the
Rest event:

resource.addListenerOnce("success", function(ev) {
  ev.getRequest().getResponseHeader("Last-Modified");
});

http://demo.qooxdoo.org/current/apiviewer/#qx.event.type.Rest

Regards,
Daniel

On 03.03.2015 12:15, Frédéric wrote:
> Hi!
>
> Is there a way to retreive the timestamp sent by the serveur in its
> response when using Rest com., through qx.io.rest.Resource?
>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Daniel Wagner
Administrator
In reply to this post by Frédéric
I can't test it right now, but configureRequest should do it:

res.configureRequest(function(req, action, params, data) {
  req.setRequestData("foo=bar");
});

On 03.03.2015 12:45, Frédéric wrote:
> Another question about Rest: how can I send params with a 'long poll'
> request ?
>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Frédéric
In reply to this post by Daniel Wagner
Le 03/03/2015, Daniel a écrit :

> By timestamp do you mean a response header? You can get those from the
> Rest event:
>
> resource.addListenerOnce("success", function(ev) {
>   ev.getRequest().getResponseHeader("Last-Modified");
> });
>
> http://demo.qooxdoo.org/current/apiviewer/#qx.event.type.Rest

Thanks!

--
    Frédéric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Frédéric
In reply to this post by Daniel Wagner
Le 03/03/2015, Daniel a écrit :

> I can't test it right now, but configureRequest should do it:
>
> res.configureRequest(function(req, action, params, data) {
>   req.setRequestData("foo=bar");
> });

I made some tests, and I see 2 problems:

- params are not passed as REST url. For example, I have a REST resource
  pointing to /eib/new, and I want to add my ts as /eib/new/<ts>. If I use
  the setRequestData(), I get something like /eib/new/?ts=xxx...

- I can't give a private param of the class owning the REST resource (this
  is not defined in the function).

--
    Frédéric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Daniel Wagner
Administrator


On 03.03.2015 14:58, Frédéric wrote:

> Le 03/03/2015, Daniel a écrit :
>
>> I can't test it right now, but configureRequest should do it:
>>
>> res.configureRequest(function(req, action, params, data) {
>>   req.setRequestData("foo=bar");
>> });
>
> I made some tests, and I see 2 problems:
>
> - params are not passed as REST url. For example, I have a REST resource
>   pointing to /eib/new, and I want to add my ts as /eib/new/<ts>. If I use
>   the setRequestData(), I get something like /eib/new/?ts=xxx...

I'm not really a REST expert, but isn't that something you'd configure
in your resource description? Something like

var description = {
  "put": { method: "PUT", url: "/eib/new/{ts}"},
};

resource.put({ts: something}, data);

>
> - I can't give a private param of the class owning the REST resource (this
>   is not defined in the function).
>

Use Function.bind:

res.configureRequest(function(req, action, params, data) {
  req.setRequestData(this.__private);
}.bind(this));

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Frédéric
Le 03/03/2015, Daniel a écrit :

> I'm not really a REST expert, but isn't that something you'd configure
> in your resource description? Something like
>
> var description = {
>   "put": { method: "PUT", url: "/eib/new/{ts}"},
> };
>
> resource.put({ts: something}, data);

Yes, but it is not possible when using long poll; this method only takes
the resource action, but no parameters.

I simulated the long poll by resending the action with its params from the
'success' callback. Don't know if it is very clean, but it seems to work.

--
    Frédéric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Daniel Wagner
Administrator
On 03.03.2015 16:04, Frédéric wrote:

> Le 03/03/2015, Daniel a écrit :
>
>> I'm not really a REST expert, but isn't that something you'd configure
>> in your resource description? Something like
>>
>> var description = {
>>   "put": { method: "PUT", url: "/eib/new/{ts}"},
>> };
>>
>> resource.put({ts: something}, data);
>
> Yes, but it is not possible when using long poll; this method only takes
> the resource action, but no parameters.

I see. Looking at the implementation, it should be fairly easy to
support parameters in the longPoll method. It uses a single invoke()
call which would take the parameters and then repeated calls to
refresh() which uses the parameters from the original invocation. Feel
free to open an enhancement report for this.

>
> I simulated the long poll by resending the action with its params from the
> 'success' callback. Don't know if it is very clean, but it seems to work.
>

That's basically what longPoll does so it should be fine.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Rest

Frédéric
Le Tuesday 03 March 2015, Daniel a écrit :

> I see. Looking at the implementation, it should be fairly easy to
> support parameters in the longPoll method. It uses a single invoke()
> call which would take the parameters and then repeated calls to
> refresh() which uses the parameters from the original invocation. Feel
> free to open an enhancement report for this.

In my case, I need the parameter to be changed at each refresh, but I
think having at least the feature you describe could be nice. I'll have
a look at the way to open a report.

> > I simulated the long poll by resending the action with its params
> > from the 'success' callback. Don't know if it is very clean, but it
> > seems to work.
>
> That's basically what longPoll does so it should be fine.

Good!

Thanks for your help,

--
    Frédéric

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel