code: public String selectHeaderAccept(String[] accepts) {
          if (accepts.length == 0) {
              return null;
          }
          for (String accept : accepts) {
              if (isJsonMime(accept)) {
                  return accept;
              }
          }
          return StringUtil.join(accepts, ",");
      }
docs: Select the Accept header's value from the given accepts array:
  if JSON exists in the given array, use it;
  otherwise use all of them (joining into a string)
  
  @param accepts The accepts array to select from
  @return The Accept header to use. If the given array is empty,
  null will be returned (not to set the Accept header explicitly).