private JSONObject getSessionJson(HttpSession session) { try { ParticipantId user = sessionManager.getLoggedInUser(session); String address = (user != null) ? user.getAddress() : null; // TODO(zdwang): Figure out a proper session id rather than generating a // random number String sessionId = (new RandomBase64Generator()).next(10); return new JSONObject() .put(SessionConstants.DOMAIN, domain) .putOpt(SessionConstants.ADDRESS, address) .putOpt(SessionConstants.ID_SEED, sessionId); } catch (JSONException e) { LOG.severe("Failed to create session JSON"); return new JSONObject(); } } }