[Hawkular-dev] Inventory REST now has result sets pagination

Lukas Krejci lkrejci at redhat.com
Wed Apr 29 15:06:15 EDT 2015


I merely copied the approach we used in RHQ, but yes, we definitely should 
look into making it better.

I'll change that to be a single Link header with a list of URIs+rels as 
outlined in https://tools.ietf.org/html/rfc5988#section-5.5

Thanks for bringing that up!

On Wednesday, April 29, 2015 19:09:54 Viliam Rockai wrote:
> Hi Lukas,
> 
> It seems you're returning multiple "Link:" headers with URLs. I believe
> a single Link header with a list is better option. For more info
> check-out the [update] section here:
> http://pilhuhn.blogspot.de/2013/02/best-practice-for-paging-in-restful-apis.
> html
> 
> IIRC we do get access to headers in angular $resource as to a map
> object. So angular devs may have the same issue as stated in the blog
> (only single value returned once "Link" key is accessed).
> 
> Viliam
> 
> On Tue, 2015-04-28 at 11:43 +0200, Lukas Krejci wrote:
> > Hi,
> > 
> > I went ahead and prototyped the pagination support both in the backend and
> > the REST API within the boundaries of inventory.
> > 
> > Because this is a generic feature, it's been agreed that this stuff would
> > deserve a place of its own so that it can be shared amongst the various
> > hawkular components.
> > 
> > There are 2 aspects of the paging:
> > 
> > * support in backend - This basically only revolves around the
> > specification of the paging requirements and a list "wrapper" that adds
> > paging context to the results. The way how the paging will be implemented
> > will differ in each component.
> > https://github.com/hawkular/hawkular-inventory/tree/master/api/src/main/ja
> > va/org/hawkular/inventory/api/paging
> > 
> > * support in the REST API - This means to translate the query parameters
> > with the paging specification into paging java API and transform the
> > results from the backend into the set of headers attached to the
> > response.
> > 
> > The support for paging in REST in inventory is contained in these classes:
> > 
> > https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/sr
> > c/main/java/org/hawkular/inventory/rest/RequestUtil.java
> > 
> > https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/sr
> > c/main/java/org/hawkular/inventory/rest/ResponseUtil.java
> > 
> > https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/sr
> > c/main/java/org/hawkular/inventory/rest/json/Link.java
> > 
> > https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/sr
> > c/main/java/org/hawkular/inventory/rest/json/LinkDeserializer.java
> > 
> > https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/sr
> > c/main/java/org/hawkular/inventory/rest/json/LinkSerializer.java
> > 
> > Both the backend and the REST support were either taken from or were
> > heavily inspired by the paging support in RHQ.
> > 
> > Where do you think these should live? Do we have a repo for common stuff?
> > I
> > imagine we will have to have 2 separate common modules so that we don't
> > drag jaxrs deps into core components.
> > 
> > Cheers,
> > 
> > Lukas
> > 
> > 
> > 
> > 
> > _______________________________________________
> > hawkular-dev mailing list
> > hawkular-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hawkular-dev
> 
> _______________________________________________
> hawkular-dev mailing list
> hawkular-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hawkular-dev



More information about the hawkular-dev mailing list