public static PaginationContext fromContext(RoutingContext context){
  HttpServerRequest request=context.request();
  String pageStr=request.getParam(PaginationContext.CURRENT_PAGE_QUERY_PARAM);
  String perPageStr=request.getParam(PaginationContext.PER_PAGE_QUERY_PARAM);
  Integer page=null;
  Integer perPage=null;
  try {
    if (pageStr != null) {
      page=Integer.parseInt(pageStr);
    }
    if (perPageStr != null) {
      perPage=Integer.parseInt(perPageStr);
    }
  }
 catch (  NumberFormatException e) {
    DefaultErrorHandler.badRequest(context,"Invalid pagination parameters : expecting integers");
  }
  if (perPage != null && perPage > PaginationContext.MAX_PER_PAGE) {
    DefaultErrorHandler.badRequest(context,"Invalid " + PaginationContext.PER_PAGE_QUERY_PARAM + " parameter, max is "+ PaginationContext.MAX_PER_PAGE);
  }
  return new PaginationContext(page,perPage);
}

public static PaginationContext fromContext ( RoutingContext context ) { HttpServerRequest request = context . request ( ) ; String pageStr = request . getParam ( PaginationContext . CURRENT_PAGE_QUERY_PARAM ) ; String perPageStr = request . getParam ( PaginationContext . PER_PAGE_QUERY_PARAM ) ; Integer page = null ; Integer perPage = null ; try { if ( pageStr != null ) { page = Integer . parseInt ( pageStr ) ; } if ( perPageStr != null ) { perPage = Integer . parseInt ( perPageStr ) ; } } catch ( NumberFormatException e ) { DefaultErrorHandler . badRequest ( context , "Invalid pagination parameters : expecting integers" ) ; } if ( perPage != null && perPage > PaginationContext . MAX_PER_PAGE ) { DefaultErrorHandler . badRequest ( context , "Invalid " + PaginationContext . PER_PAGE_QUERY_PARAM + " parameter, max is " + PaginationContext . MAX_PER_PAGE ) ; } return new PaginationContext ( page , perPage ) ; }
the preferred way to create a paginationcontext
