use of ai.elimu.model.gson.content.WordGson in project webapp by elimu-ai.
the class WordRestController method list.
@RequestMapping("/list")
public String list(HttpServletRequest request, @RequestParam String deviceId, // TODO: checksum,
@RequestParam Locale locale) {
logger.info("list");
logger.info("request.getQueryString(): " + request.getQueryString());
JSONArray words = new JSONArray();
for (Word word : wordDao.readAllOrdered(locale)) {
WordGson wordGson = JavaToGsonConverter.getWordGson(word);
String json = new Gson().toJson(wordGson);
words.put(new JSONObject(json));
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("result", "success");
jsonObject.put("words", words);
logger.info("jsonObject: " + jsonObject);
return jsonObject.toString();
}
Aggregations