private static QueryResponseHandler createPagingHandler(QueryResourceHandler handler,QueryRequest request){
  if (isPagingRequested(request)) {
    return new PagingQueryResponseHandler(new QueryResponseHandler(handler),Math.max(0,request.getPageSize()),Math.max(0,request.getPagedResultsOffset()));
  }
 else {
    return new QueryResponseHandler(handler);
  }
}

private static QueryResponseHandler createPagingHandler ( QueryResourceHandler handler , QueryRequest request ) { if ( isPagingRequested ( request ) ) { return new PagingQueryResponseHandler ( new QueryResponseHandler ( handler ) , Math . max ( 0 , request . getPageSize ( ) ) , Math . max ( 0 , request . getPagedResultsOffset ( ) ) ) ; } else { return new QueryResponseHandler ( handler ) ; } }
validate the queryrequest and determine if we have enough information to provide paging for the caller .
