303 for paging; was Re: 2NN Contents Of Related (303 Shortcut)

On 09/05/2014 01:54 PM, Roy T. Fielding wrote:
>> >The actual driving force behind this I-D is not about using 303s to deal with httpRange-14, it's to deal with paging.  That is, the client does a GET on A, including these request headers:
>> >
>> >   Prefer: contents-of-related
>> >   Prefer: return=representation; max-triple-count="100"
>> >
>> >and now the server can directly provide the first hundred triples, via a representation of B, which is that the first "page" of A.
> The first hundred triples is a representation of resource A.
> There is no requirement, anywhere, that representations be complete.
> Prefer in this case is just another form of content negotiation and
> the response is 200.  Responding 303 in this case would be wrong,
> as would 2NN.
>

This is a crucial point.    If even responding 303 is wrong, we have a 
bigger problem.

It sounds to me like you're saying that a chapter of a book is the same 
thing as the entire book.

Let's say we have an online textbook available at:

    http://example.org/WebDesign

and each of its 40 chapters is available as a separate web page, with 
chapter number CC being available at

    http://example.org/WebDesign?chapter={CC}

Now imagine a client does GET http://example.org/WebDesign, with a 
prefer header saying it's fine to just send the first chapter if the 
book is too big.

I think you're saying it would be fine for the server to respond 200 OK, 
Content-Location: http://example.org/WebDesign?chapter=1, and give the 
content of that first chapter.

To my understanding, that's wrong, because it violates the semantics of 
200 OK and Content-Location.  Specifically, since a book is not the same 
thing as its first chapter, http://example.org/WebDesign and 
http://example.org/WebDesign?chapter=1 are distinct resources. If they 
are distinct we can't use 200 OK+CL to respond to one with the other.

I think I hear you saying that resources being distinct doesn't matter, 
that the notion of "representation" is much fuzzier than that.  I think 
you're saying that even though a chapter of a book and a book are 
different, it's fine to response 200 OK and give the text of the chapter 
as a representation of the book (assuming there was some negotiation 
licensing such behavior).

If the HTTP WG really has consensus on that idea, I guess I can live 
with it, even though it's counterintuitive to me.

But how far does this go?    When is 200+CL not okay?    Could the first 
sentence of the book be a representation of it?   How about the the 
first letter?   How about the 10th letter?    How about the 13th, 7th, 
and 22nd letters, in that order?    How about the first word of a 
different book?   How about the first sentence of a different book?   
How about the entire contents of a different book?    I don't see how 
you can draw a line here, with this way of thinking about it.

To me, and the LDP WG, it's made a lot more sense to think of a chapter 
as simply being a different resource than the book, so if the server's 
going to give back a representation of the chapter, it can't use 200 OK.

          -- Sandro

Received on Sunday, 7 September 2014 14:43:44 UTC