code: private static void setDpiValue(final Multimap<String, String> extraParams, final int dpi) {
          String searchKey = "FORMAT_OPTIONS";
          for (String key: extraParams.keys()) {
              if (key.equalsIgnoreCase(searchKey)) {
                  Collection<String> values = extraParams.removeAll(key);
                  List<String> newValues = new ArrayList<>();
                  for (String value: values) {
                      if (!StringUtils.isEmpty(value)) {
                          value += ";dpi:" + Integer.toString(dpi);
                          newValues.add(value);
                      }
                  }
                  extraParams.putAll(key, newValues);
                  return;
              }
          }
      }
docs: Set the DPI value for GeoServer if there are already FORMAT_OPTIONS.