In our current project we have lots of resources which return a subset of
bigger datasets. For that the paging information is provided as part of the
URL:
/<some resource>/{offset}/{limit}[/{sortBy}[/{sortDirection}]]
[] parts are optional. So valid URLs are
/customers/0/50
/customers/0/50/name
/customers/0/50/createdAt/desc
This works perfectly up to the fact that lots of request attributes are
occupied. For example we cannot map the URL "/customers/orders/{orderId}",
because it is already used for "/customers/{offset}/{limit}.
As an alternative I like to provide the paging information using the range
header:
Range: items={offset}-{lastIndex}
For more information see discussions at
http://stackoverflow.com/questions/924472/paging-in-a-rest-collection and
http://docs.dojocampus.org/dojox/data/JsonRestStore#paging.
What I lack is a possibility to set this kind of header information in GWT.
There's the method "ClientResource.setRanges()", but it generates the range
header using a hardcoded "bytes=..." value, which I don't want to use.
Is there a way to set custom HTTP headers in GWT? Another more compliant
solution would be to include some kind of unit in the Range class. This unit
would be "bytes" by default and is used by the RangeWriter when generating the
header value.
- Harald
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2642337