users@jersey.java.net

[Jersey] Re: Pagination

From: William Bowen <williamrbowen_at_gmail.com>
Date: Sat, 6 Sep 2014 21:13:19 -0400

Thanks for that Van. I vaguely remember looking at that before, it just
seemed weird to me to return HTTP 206 instead of 200 when a request came in
for a paginated resource that would retrieve a subset of records. In all
the examples, I think maybe I assumed it was also only applicable to bytes,
and not arbitrary units. So Nishant you could use the Range headers instead
of my "X-" headers and return HTTP 416 in my pagination exception if you
wanted to use those.

The first link Van referenced mentions including the Accept-Ranges header
in OPTIONS requests, which I believe Jersey auto-magically processes, so
that might require a little bit more doing to hand off to something to
perform that calculation and then put the header in the response.

For your question Nishant, I don't have direct experience using the
declarative linking module. According to 12.4 on
https://jersey.java.net/documentation/latest/declarative-linking.html,
maybe you could make multiple InjectLink annotations that would hand off
based on your filter (new, cancelled, etc.) accordingly? Or could you make
one universal method that's able to make that determination based on
something you already stuffed in the request context?