February 2019
Intermediate to advanced
442 pages
11h 46m
English
When applying the filter option, JHipster also makes necessary changes to the REST controller. For example, all get methods of REST controller CountryResouce for entity Country are now taking CountryCriteria as a parameter to support filtering operations, as follows:
@GetMapping("/countries") @Timed public ResponseEntity<List<CountryDTO>> getAllCountries( CountryCriteria criteria, Pageable pageable) { log.debug("REST request to get Countries by criteria: {}", criteria); Page<CountryDTO> page = countryQueryService.findByCriteria(criteria, pageable); HttpHeaders headers = PaginationUtil. generatePaginationHttpHeaders(page, "/api/countries"); return ResponseEntity.ok().headers(headers).body(page.getContent()); }