コード例 #1
0
 /**
  * TODO - This doesn't actually get selected since the query param is in the form of 'sort(...)'
  * instead of 'sort=(...)'
  */
 @RequestMapping(
     method = RequestMethod.GET,
     headers = {ACCEPT_JSON, "Range"},
     params = "sort")
 public @ResponseBody HttpEntity<List<USState>> listJsonForRangeSorted(
     @RequestHeader("Range") String range, @RequestParam("sort") String sort) {
   HttpHeaders headers = new HttpHeaders();
   List<USState> body = null;
   Range parsedRange = new Range(range.replaceAll(RANGE_PREFIX, ""));
   long count = USState.countUSStates();
   // TODO - Implement sort param parsing
   body =
       USState.findOrderedUSStateEntries(
           parsedRange.getFirstResult(), parsedRange.getMaxResults(), "");
   headers.add(
       CONTENT_RANGE_HEADER,
       getContentRangeValue(parsedRange.getFirstResult(), body.size(), count));
   return new HttpEntity<List<USState>>(body, headers);
 }