@RequestMapping(params="words", method = RequestMethod.POST)
public ResponseEntity<String> checkWordList(@RequestParam("words") String words){
JSONObject response = new JSONObject();
SpellChecker spellChecker = new SpellChecker();
Configuration cfg = spellChecker.getConfiguration();
cfg.setBoolean(Configuration.SPELL_IGNOREUPPERCASE, false);
Checker chk = new Checker();
spellChecker.addSpellCheckListener(chk);
for (SpellDictionary dictionary : dictionaries) {
spellChecker.addDictionary(dictionary);
}
chk.init(response);
spellChecker.checkSpelling(new StringWordTokenizer(words.trim()));
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
return new ResponseEntity<String>(response.toString(), headers, HttpStatus.OK);
}