addCss(buf, request);
// creat parameters map
Map<String, String> params = new HashMap<String, String>();
RenderContext renderContext = (RenderContext) request.getAttribute("renderContext");
String serviceEntrypoint = buildServiceBaseEntrypointUrl(request);
params.put(JahiaGWTParameters.SERVICE_ENTRY_POINT, serviceEntrypoint);
params.put(JahiaGWTParameters.CONTEXT_PATH, request.getContextPath().equals("/")?"":request.getContextPath());
params.put(JahiaGWTParameters.SERVLET_PATH, request.getServletPath());
params.put(JahiaGWTParameters.PATH_INFO, request.getPathInfo());
params.put(JahiaGWTParameters.QUERY_STRING, request.getQueryString());
JahiaUser user = (JahiaUser) session.getAttribute(ParamBean.SESSION_USER);
if (user != null) {
String name = user.getUsername();
int index = name.indexOf(":");
if (index > 0) {
String displayname = name.substring(0, index);
params.put(JahiaGWTParameters.CURRENT_USER_NAME, displayname);
} else {
params.put(JahiaGWTParameters.CURRENT_USER_NAME, name);
}
} else {
params.put(JahiaGWTParameters.CURRENT_USER_NAME, "guest");
}
params.put(JahiaGWTParameters.LANGUAGE, locale.toString());
params.put(JahiaGWTParameters.LANGUAGE_DISPLAY_NAME, WordUtils.capitalizeFully(locale.getDisplayName(locale)));
params.put(JahiaGWTParameters.UI_LANGUAGE, uilocale.toString());
params.put(JahiaGWTParameters.UI_LANGUAGE_DISPLAY_NAME, WordUtils.capitalizeFully(uilocale.getDisplayName(uilocale)));
try {
if (renderContext != null) {
params.put(JahiaGWTParameters.WORKSPACE, renderContext
.getMainResource().getWorkspace());
if (renderContext.getSite() != null) {
params.put(JahiaGWTParameters.SITE_UUID, renderContext.getSite().getIdentifier());
params.put(JahiaGWTParameters.SITE_KEY, renderContext.getSite().getSiteKey());
}
} else {
if (request.getParameter("site") != null) {
params.put(JahiaGWTParameters.SITE_UUID, request.getParameter("site"));
} else {