protected String getAppName() { return config.getWebContextName(); }
protected String getBasePath() { return "/" + globalConfig.getWebContextName() + "/rest/v2"; }
protected String getWebAppName(GlobalConfig config) { return config.getWebContextName(); }
protected String getMBeanDomain() { return globalConfig.getWebContextName() + ".jgroups"; }
/** * Basically this method prepends webapp's prefix to the path * * @param path path relative to the root of webapp * @return Full relative path on server */ public String composeFullRelativePath(String path) { GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class); String webAppPrefix = "/".concat(globalConfig.getWebContextName().intern()); return path.startsWith("/") ? webAppPrefix.concat(path) : webAppPrefix.concat("/").concat(path); }
public void setUserAppTheme(String themeName) { addCookie(APP_THEME_COOKIE_PREFIX + globalConfig.getWebContextName(), themeName); }
protected String makeClientInfo(String userAgent) { //noinspection UnnecessaryLocalVariable String serverInfo = String.format("REST API (%s:%s/%s) %s", globalConfig.getWebHostName(), globalConfig.getWebPort(), globalConfig.getWebContextName(), StringUtils.trimToEmpty(userAgent)); return serverInfo; }
protected String makeClientInfo(String userAgent) { //noinspection UnnecessaryLocalVariable String serverInfo = String.format("REST API (%s:%s/%s) %s", globalConfig.getWebHostName(), globalConfig.getWebPort(), globalConfig.getWebContextName(), StringUtils.trimToEmpty(userAgent)); return serverInfo; }
protected String getPortalNetworkLocation() { return globalConfig.getWebHostName() + ":" + globalConfig.getWebPort() + "/" + globalConfig.getWebContextName(); }
protected String makeClientInfo(String userAgent) { GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class); //noinspection UnnecessaryLocalVariable String serverInfo = String.format("REST API (%s:%s/%s) %s", globalConfig.getWebHostName(), globalConfig.getWebPort(), globalConfig.getWebContextName(), StringUtils.trimToEmpty(userAgent)); return serverInfo; } }
if (contextPath.startsWith("/")) contextPath = contextPath.substring(1); if (!contextPath.equals(config.getWebContextName())) { sb.append("***** cuba.webContextName=").append(config.getWebContextName()) .append(", actual=").append(contextPath).append("\n");
protected String resolveServerPrefix(String uri) { Configuration configStorage = AppBeans.get(Configuration.NAME); GlobalConfig globalConfig = configStorage.getConfig(GlobalConfig.class); String coreUrl = String.format("http://%s:%s/%s/", globalConfig.getWebHostName(), globalConfig.getWebPort(), globalConfig.getWebContextName()); String webUrl = globalConfig.getWebAppUrl() + "/"; return uri.replace(WEB_APP_PREFIX, webUrl).replace(CORE_APP_PREFIX, coreUrl); }
@Override public String getServerId() { if (serverId == null) { GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class); serverId = globalConfig.getWebHostName() + ":" + globalConfig.getWebPort() + "/" + globalConfig.getWebContextName(); } return serverId; }
protected ThemeConstants loadTheme() { String appWindowTheme = webConfig.getAppWindowTheme(); String userAppTheme = cookies.getCookieValue(APP_THEME_COOKIE_PREFIX + globalConfig.getWebContextName()); if (userAppTheme != null) { if (!Objects.equals(userAppTheme, appWindowTheme)) { // check theme support Set<String> supportedThemes = themeConstantsRepository.getAvailableThemes(); if (supportedThemes.contains(userAppTheme)) { appWindowTheme = userAppTheme; } } } ThemeConstants theme = themeConstantsRepository.getConstants(appWindowTheme); if (theme == null) { throw new IllegalStateException("Unable to use theme constants '" + appWindowTheme + "'"); } return theme; }
protected String makeClientInfo() { // timezone info is passed only on VaadinSession creation WebBrowser webBrowser = getWebBrowserDetails(); //noinspection UnnecessaryLocalVariable String serverInfo = String.format("Web (%s:%s/%s) %s", globalConfig.getWebHostName(), globalConfig.getWebPort(), globalConfig.getWebContextName(), webBrowser.getBrowserApplication()); return serverInfo; }
protected void setSessionInfo(HttpServletRequest request, UserSession userSession) { userSessionService.setSessionAddress(userSession.getId(), request.getRemoteAddr()); String serverInfo = "REST API (" + globalConfig.getWebHostName() + ":" + globalConfig.getWebPort() + "/" + globalConfig.getWebContextName() + ") "; userSessionService.setSessionClientInfo(userSession.getId(), serverInfo + request.getHeader("User-Agent")); }
protected Map<String, Object> getSessionParams(String ipAddress, String clientInfo) { GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class); String serverInfo = "Portal (" + globalConfig.getWebHostName() + ":" + globalConfig.getWebPort() + "/" + globalConfig.getWebContextName() + ") "; return ParamsMap.of( ClientType.class.getName(), AppContext.getProperty("cuba.clientType"), SessionParams.IP_ADDRESS.getId(), ipAddress, SessionParams.CLIENT_INFO.getId(), serverInfo + clientInfo ); }
@Override public String getTheme(UICreateEvent event) { // get theme from cookies before app ui initialized for smooth theme enabling WebConfig webConfig = configuration.getConfig(WebConfig.class); GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class); String appWindowTheme = webConfig.getAppWindowTheme(); String userAppTheme = getCookieValue(event.getRequest().getCookies(), App.APP_THEME_COOKIE_PREFIX + globalConfig.getWebContextName()); if (userAppTheme != null) { if (!Objects.equals(userAppTheme, appWindowTheme)) { // check theme support ThemeConstantsRepository themeRepository = AppBeans.get(ThemeConstantsRepository.NAME); Set<String> supportedThemes = themeRepository.getAvailableThemes(); if (supportedThemes.contains(userAppTheme)) { return userAppTheme; } } } return super.getTheme(event); }
StopWatch stopWatch = null; MDC.put("user", userSessionSource.getUserSession().getUser().getLogin()); MDC.put("webContextName", globalConfig.getWebContextName()); executions.startExecution(report.getId().toString(), "Reporting"); try {