Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing the HTTP Range Header with a range specifier other than bytes?
    primarykey
    data
    text
    <p>The core question is about the use of the HTTP Headers, including <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35" rel="nofollow noreferrer">Range</a>, <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.27" rel="nofollow noreferrer">If-Range</a>, <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.5" rel="nofollow noreferrer">Accept-Ranges</a> and a user defined range specifier.</p> <p>Here is a manufactured example to help illustrate my question. Assume I have a Web 2.0 style application that displays some sort of human readable documents. These documents are editorially broken up into pages (similar to articles you see on news websites). For this example, assume:</p> <ul> <li>There is a document titled "HTTP Range Question" is broken up into three pages.</li> <li>The shell page (<code>/document/shell/http-range-question</code>) knows the meta information about the document, including the number of pages.</li> <li>The first readable page of the document is loaded during the page onload event via an ajax GET and inserted onto the page.</li> <li>A UI control that looks like <strong>[ 1 2 3 All ]</strong> is at the bottom of the page, and clicking on a number will display that readable page (also loaded via ajax), and clicking "All" will display the entire document. Assume these URLS for the 1, 2, 3 and All use cases: <ul> <li><code>/document/content/http-range-question?page=1</code></li> <li><code>/document/content/http-range-question?page=2</code></li> <li><code>/document/content/http-range-question?page=3</code></li> <li><code>/document/content/http-range-question</code></li> </ul></li> </ul> <p>Now to the question. Can I use the HTTP Range headers instead part of the URL (e.g. a querystring parameter)? Maybe something like this on the <code>GET /document/content/http-range-question</code> request:</p> <pre><code>Range: page=1 </code></pre> <p>It looks like the spec only defines byte ranges as allowable, so even if I made my ajax calls work with my browser and server code, anything in the middle could break the contract (e.g. a caching proxy server).</p> <pre><code>Range: bytes=0-499 </code></pre> <p>Any opinions or real world examples of custom range specifiers?</p> <p><strong>Update</strong>: I did find a similar question about the Range header (<a href="https://stackoverflow.com/questions/924472/paging-in-a-rest-collection">Paging in a Rest Collection</a>) where they mention that Dojo's <a href="http://docs.dojocampus.org/dojox/data/JsonRestStore" rel="nofollow noreferrer">JsonRestStore</a> uses a custom Range header value.</p> <pre><code>Range: items=0-24 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload