throws PaintException {
VaadinRequest request = context.getRequest();
VaadinSession session = context.getSession();
VaadinService vaadinService = request.getService();
JsonObject appConfig = Json.createObject();
String themeName = context.getThemeName();
if (themeName != null) {
appConfig.put("theme", themeName);
}
// Ignore restartApplication that might be passed to UI init
if (request
.getParameter(VaadinService.URL_PARAMETER_RESTART_APPLICATION) != null) {
appConfig.put("extraParams", "&" + IGNORE_RESTART_PARAM + "=1");
}
JsonObject versionInfo = Json.createObject();
versionInfo.put("vaadinVersion", Version.getFullVersion());
appConfig.put("versionInfo", versionInfo);
appConfig.put("widgetset", context.getWidgetsetName());
// Use locale from session if set, else from the request
Locale locale = ServletPortletHelper.findLocale(null,
context.getSession(), context.getRequest());
// Get system messages
SystemMessages systemMessages = vaadinService.getSystemMessages(locale,
request);
if (systemMessages != null) {
// Write the CommunicationError -message to client
JsonObject comErrMsg = Json.createObject();
comErrMsg.put("caption",
systemMessages.getCommunicationErrorCaption());
comErrMsg.put("message",
systemMessages.getCommunicationErrorMessage());
if (systemMessages.getCommunicationErrorURL() == null) {
comErrMsg.put("url", Json.createNull());
} else {
comErrMsg.put("url", systemMessages.getCommunicationErrorURL());
}
appConfig.put("comErrMsg", comErrMsg);
JsonObject authErrMsg = Json.createObject();
authErrMsg.put("caption",
systemMessages.getAuthenticationErrorCaption());
authErrMsg.put("message",
systemMessages.getAuthenticationErrorMessage());
if (systemMessages.getAuthenticationErrorURL() == null) {
authErrMsg.put("url", Json.createNull());
} else {
authErrMsg.put("url",
systemMessages.getAuthenticationErrorURL());
}
appConfig.put("authErrMsg", authErrMsg);
JsonObject sessExpMsg = Json.createObject();
sessExpMsg
.put("caption", systemMessages.getSessionExpiredCaption());
sessExpMsg
.put("message", systemMessages.getSessionExpiredMessage());
if (systemMessages.getSessionExpiredURL() == null) {
sessExpMsg.put("url", Json.createNull());
} else {
sessExpMsg.put("url", systemMessages.getSessionExpiredURL());
}
appConfig.put("sessExpMsg", sessExpMsg);
}