Reputation: 1082
I have a handler like this:
@GetMapping("/users")
@Timed
public ResponseEntity<List<UserDTO>> getAllUsers(@ApiParam Pageable pageable) {
log.debug("REST request to get a page of Users");
Page<UserDTO> page = userService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
It was generated by JHipster. My main issue with this is that i dont understand what the front end is supposed to send to match Pageable
object.
This handler will should return paginated users based on search words submitted by the user. I am using mongodb.
Upvotes: 0
Views: 637
Reputation: 2711
Based on this github issue it states
The custom pagable parameters (limit, offset) are replaced to the Spring custom argument resolver PageableHandlerMethodArgumentResolver
You can find the code for PageableHandlerMethodArgumentResolver here. The default parameter names are "page" and "size". You might want to take a look at the jhipster-sample-app-mongodb which does look to showcase pagination. Example can be found here
Upvotes: 1