if (!userQueryService.isLoggedIn(request, response)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
final JSONRenderer renderer = new JSONRenderer();
context.setRenderer(renderer);
try {
final JSONObject preference = preferenceQueryService.getPreference();
final JSONArray signs = new JSONArray();
final JSONArray allSigns = // includes the empty sign(id=0)
new JSONArray(preference.getString(Preference.SIGNS));
for (int i = 1; i < allSigns.length(); i++) { // excludes the empty sign
signs.put(allSigns.getJSONObject(i));
}
final JSONObject ret = new JSONObject();
renderer.setJSONObject(ret);
ret.put(Sign.SIGNS, signs);
ret.put(Keys.STATUS_CODE, true);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e);
final JSONObject jsonObject = QueryResults.defaultResult();
renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("getFailLabel"));
}
}