I have one requirement is to search by pageable and non-pageable,
and in my Java code, I use spring data jpa Pageable class,
Pageable pageable = new
This works for me:
All pageable request use MyCustomPage
and use a default page and size if not found in request.
If size (number of record exceed the max value) i set a default value, which in this case 50.
public class MyCustomPage extends PageRequest{
Integer MAX_PAGE_SIZE = 50
//constructor
public MyCustomPage(Integer page, Integer size) {
super(page,(size>MAX_PAGE_SIZE)?MAX_PAGE_SIZE:size);
}
}