public void startJSON(WebloungeRequest request, WebloungeResponse response)
throws IOException, ActionException {
try {
String language = RequestUtils.getParameter(request, LANGUAGE_PARAM);
if (language == null)
throw new ActionException(HttpServletResponse.SC_BAD_REQUEST);
Map<String, String> data = new HashMap<String, String>();
String encoding = response.getCharacterEncoding();
if (encoding == null)
encoding = "utf-8";
data.put(language, new String(greeting.getBytes(encoding), encoding));
ObjectMapper mapper = new ObjectMapper();
mapper.writeValue(response.getOutputStream(), data);
} catch (IOException e) {
throw new ActionException("Unable to send json response", e);
}
}