Skip to content

Instantly share code, notes, and snippets.

@abstractj
Last active December 11, 2015 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abstractj/a167f34408281527e7ee to your computer and use it in GitHub Desktop.
Save abstractj/a167f34408281527e7ee to your computer and use it in GitHub Desktop.
Suggestion on pagination API
public PagedResponse findCarsByBrand(final String name
final List<Car> cars = findSummersCarsByName(name);
return cars;
}
public int getCarsTotal(){
//return something
}
Route()
.from("/cars")
.on(RequestMethod.GET)
.produces(MediaType.JSON, CustomMediaTypeResponder.MEDIA_TYPE)
.pagedTotalsCallback("getCarsTotal") //props do @danbev
.to(Cars.class).findCarsByBrand(param("name")
.offset(offset)
.limit(limit)
.total(total));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment