private static int checkNumItems ( final HttpServletRequest request , final ReadResponse response ) { final String sNumItems = request . getParameter ( ProtocolConstants . Parameters . Read . NUM_ITEMS ) ; if ( sNumItems != null ) { int numItems ; try { numItems = Integer . valueOf ( sNumItems ) ; if ( numItems > 0 ) { return numItems ; } response . numItemsInvalid ( "Please provide a number greater than zero." ) ; } catch ( final NumberFormatException e ) { response . numItemsInvalid ( "\"" + sNumItems + "\" is not a number. Please provide a number such as \"15\" to retrieve that number of items." ) ; } } else { response . numItemsMissing ( ) ; } return 0 ; }
check if the request contains a valid number of items to retrieve