Controller:
@RestController
@RequestMapping("/api")
public class TestResource {
@RequestMapping(value="/test",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Integer>> test(Pageable pageable) {
List<Integer> init = new ArrayList<>(Arrays.asList(new Integer[]{1,2,3,4,5,6,7,8,9,10}));
return ResponseEntity.ok(new PageImpl<>(init, pageable, init.size()).getContent());
}
}
Request /api/test?page=1&size=2 returns entire init list (from 1 to 10).
From logs:
Enter: com.test.rest.TestResource.test() with argument[s] = [Page request [number: 1, size 2, sort: null]]
How to make it work?