/** * Get paged request by performing multiple requests until no more pages are * available or an exception occurs. * * @param <V> * @param request * @return list of all elements * @throws IOException */ protected <V> List<V> getAll(PagedRequest<V> request) throws IOException { return getAll(createPageIterator(request)); }
/** * Unified paged request creation method that all sub-classes should use so * overriding classes can extend and configure the default request. * * @return request */ protected <V> PagedRequest<V> createPagedRequest() { return createPagedRequest(PAGE_FIRST, PAGE_SIZE); }
/** * Check if the uri returns a non-404 * * @param uri * @return true if no exception, false if 404 * @throws IOException */ protected boolean check(String uri) throws IOException { try { client.get(createRequest().setUri(uri)); return true; } catch (RequestException e) { if (e.getStatus() == HTTP_NOT_FOUND) return false; throw e; } }