Subject: Re: issue 85 - range unit extensions

From: "Kris Zyp" <[email-masked]>
Date: Fri, 29 Aug 2008 14:16:04 -0600

I was referred to this discussion since it sounds like there consideration for deprecating alternate range units. I just wanted to let the group know that Dojo is currently using an range unit "items" for doing paged requests with it's JSON REST client. The HTTP specification makes it sound like this is the most appropriate technique for doing paged/range requests (and the byte unit will not do, it would result in invalid JSON). I believe we are doing something similar to what is mentioned in the referenced article: http://msdn.microsoft.com/en-us/magazine/cc301869.aspx (we could change to "rows" if desired).

When Dojo wants to have paged set of JSON objects (used in the Dojo Grid) it will create a request like:
GET /Customer/
Range: items=-19

And expects servers that are aware of the "items" range unit to respond with something like:
GET /Customer/
Content-Range: items 0-19/244
[{name:"item one"},{....

Thanks,
Kris

---

From: Julian Reschke <[email-masked]>
Date: Sun, 31 Aug 2008 13:39:44 +0200

Kris Zyp wrote:
> 
> I was referred to this discussion since it sounds like there 
> consideration for deprecating alternate range units. I just wanted to 

I'd say "either to repair or to deprecate them".

> let the group know that Dojo is currently using an range unit "items" 
> for doing paged requests with it's JSON REST client. The HTTP 
> specification makes it sound like this is the most appropriate technique 
> for doing paged/range requests (and the byte unit will not do, it would 
> result in invalid JSON). I believe we are doing something similar to 
> what is mentioned in the referenced 
> article: http://msdn.microsoft.com/en-us/magazine/cc301869.aspx (we 
> could change to "rows" if desired).

No, please don't do that :-).

> Content-Range: items 0-19/244

Looks good to me.

Out of curiosity: did you consider simply using a query parameter 
instead? If you did, and decided not to, that would be interesting for 
the question whether custom ranges are a good idea after all.

BR, Julian

---

From: "Kris Zyp" <[email-masked]>
Date: Sun, 31 Aug 2008 07:32:39 -0600

> Out of curiosity: did you consider simply using a query parameter instead? 
> If you did, and decided not to, that would be interesting for the question 
> whether custom ranges are a good idea after all.

Yes, I considered that, but here is no standard for query parameters, AFAIK. 
Since Dojo is a client side library, we are aiming for maximum 
interoperability with servers by following the HTTP specification as closely 
as possible, so servers have a real standard to go off of instead something 
we made up. It seems like leveraging the range/partial content mechanism 
with alternate range unit is the approach that HTTP would suggest, and I 
have no reason to believe it is wrong. Retrieving a paged subset of data is 
merely a different representation of the same resource.
Kris

---

From: Julian Reschke <[email-masked]>
Date: Mon, 01 Sep 2008 10:22:09 +0200

Kris Zyp wrote:
> Yes, I considered that, but here is no standard for query parameters, 
> AFAIK. Since Dojo is a client side library, we are aiming for maximum 

Nope.

> interoperability with servers by following the HTTP specification as 
> closely as possible, so servers have a real standard to go off of 
> instead something we made up. It seems like leveraging the range/partial 
> content mechanism with alternate range unit is the approach that HTTP 
> would suggest, and I have no reason to believe it is wrong. Retrieving a 
> paged subset of data is merely a different representation of the same 
> resource.

Yes. But, making up new range units shares has similar problems as 
making up query parameters, doesn't it?

To make this robust, we'd really need a registry.

BR, Julian