Config.set(request, Config.FMT_LOCALIZATION_CONTEXT,
new LocalizationContext(new JahiaResourceBundle(uiLocale, site.getTemplatePackageName()), uiLocale));
AdministrationModulesRegistry modulesRegistry = (AdministrationModulesRegistry) SpringContextSingleton.getInstance().getContext().getBean("administrationModulesRegistry");
AdministrationModule currentModule = modulesRegistry.getServerAdministrationModule(operation);
if (currentModule != null) {
if (hasSitePermission(currentModule.getPermissionName(), site.getSiteKey()) || hasServerPermission(currentModule.getPermissionName())) {
session.setAttribute(CLASS_NAME + "configJahia", Boolean.TRUE);
/** todo clean up this hardcoded mess. Is it even used anymore ? */
if ("sharecomponents".equals(operation) && user.isRoot()) {
request.setAttribute("showAllComponents", Boolean.TRUE);
}
currentModule.service(request, response);
} else if ("sites".equals(operation) && (session.getAttribute(JahiaAdministration.CLASS_NAME + "redirectToJahia") != null)) {
session.setAttribute(CLASS_NAME + "configJahia", Boolean.TRUE);
currentModule.service(request, response);
}
} else {
currentModule = modulesRegistry.getSiteAdministrationModule(operation);
if (currentModule != null) {
if (hasSitePermission(currentModule.getPermissionName(), site.getSiteKey())) {
session.setAttribute(CLASS_NAME + "configJahia", Boolean.FALSE);
if ("search".equals(operation)) {
// Use response wrapper to ensure correct handling of Application fields output to the response
// @todo is this still necessary with Pluto wrapper in effect ?
currentModule.service(new ServletIncludeRequestWrapper(request), new ServletIncludeResponseWrapper(response, true, SettingsBean.getInstance().getCharacterEncoding()));
} else {
currentModule.service(request, response);
}
}
}
}