@Override protected JSONStreamAware processRequest(HttpServletRequest req) throws ParameterException { long[] currencyIds = ParameterParser.getUnsignedLongs(req, "currencies"); boolean includeCounts = "true".equalsIgnoreCase(req.getParameter("includeCounts")); JSONObject response = new JSONObject(); JSONArray currenciesJSONArray = new JSONArray(); response.put("currencies", currenciesJSONArray); for (long currencyId : currencyIds) { Currency currency = Currency.getCurrency(currencyId); if (currency == null) { return UNKNOWN_CURRENCY; } currenciesJSONArray.add(JSONData.currency(currency, includeCounts)); } return response; }