Tabnine Logo
GlobalConfig
Code IndexAdd Tabnine to your IDE (free)

How to use
GlobalConfig
in
com.haulmont.cuba.core.global

Best Java code snippets using com.haulmont.cuba.core.global.GlobalConfig (Showing top 20 results out of 315)

origin: com.haulmont.cuba/cuba-global

/**
 * @return first locale from the list defined in {@code cuba.availableLocales} app property, taking into
 * account {@link #useLocaleLanguageOnly()} return value.
 */
public Locale getDefaultLocale() {
  if (globalConfig.getAvailableLocales().isEmpty())
    throw new DevelopmentException("Invalid cuba.availableLocales application property");
  return globalConfig.getAvailableLocales().entrySet().iterator().next().getValue();
}
origin: com.haulmont.cuba/cuba-global

@Inject
public void setConfiguration(Configuration configuration) {
  globalConfig = configuration.getConfig(GlobalConfig.class);
  confDir = globalConfig.getConfDir().replaceAll("\\\\", "/");
}
origin: com.haulmont.cuba/cuba-portal

protected String getPortalNetworkLocation() {
  return globalConfig.getWebHostName() + ":" +
      globalConfig.getWebPort() + "/" +
      globalConfig.getWebContextName();
}
origin: com.haulmont.cuba/cuba-rest-api

protected String getHost() {
  return globalConfig.getWebHostName() + ":" + globalConfig.getWebPort();
}
origin: com.haulmont.reports/reports-core

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);
}
origin: com.haulmont.cuba/cuba-idp

@GetMapping(value = "/locales", produces = "application/json; charset=UTF-8")
@ResponseBody
public LocalesInfo getLocales() {
  LocalesInfo localesInfo = new LocalesInfo();
  localesInfo.setLocaleSelectVisible(globalConfig.getLocaleSelectVisible());
  Map<String, String> locales = new LinkedHashMap<>();
  for (Map.Entry<String, Locale> entry : globalConfig.getAvailableLocales().entrySet()) {
    locales.put(entry.getValue().toLanguageTag(), entry.getKey());
  }
  localesInfo.setLocales(locales);
  return localesInfo;
}
origin: com.haulmont.cuba/cuba-core

if (!checkCompleted) {
  GlobalConfig config = AppBeans.get(Configuration.class).getConfig(GlobalConfig.class);
  if (config.getLogIncorrectWebAppPropertiesEnabled()) {
    StringBuilder sb = new StringBuilder();
    if (!request.getServerName().equals(config.getWebHostName())) {
      sb.append("***** cuba.webHostName=").append(config.getWebHostName())
          .append(", actual=").append(request.getServerName()).append("\n");
    if (request.getServerPort() != Integer.parseInt(config.getWebPort())) {
      sb.append("***** cuba.webPort=").append(config.getWebPort())
          .append(", actual=").append(request.getServerPort()).append("\n");
    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");
origin: com.haulmont.cuba/cuba-web

protected String getWebAppName(GlobalConfig config) {
  return config.getWebContextName();
}
origin: com.haulmont.cuba/cuba-global

@Inject
public JavaClassLoader(Configuration configuration) {
  super(new URL[0], Thread.currentThread().getContextClassLoader());
  this.proxyClassLoader = new ProxyClassLoader(Thread.currentThread().getContextClassLoader(), compiled);
  GlobalConfig config = configuration.getConfig(GlobalConfig.class);
  this.rootDir = config.getConfDir() + "/";
  this.cubaClassPath = config.getCubaClasspathDirectories();
  this.classPath = buildClasspath();
  this.sourceProvider = new SourceProvider(rootDir);
}
origin: com.haulmont.cuba/cuba-portal

/**
 * @param path path relative to the root of webapp
 * @return Full absolute path including protocol, domain and webapp prefix
 */
public String composeFullAbsolutePath(String path) {
  String webAppUrl = configuration.getConfig(GlobalConfig.class).getWebAppUrl();
  webAppUrl = StringUtils.chomp(webAppUrl, "/"); //remove last slash
  return path.startsWith("/") ? webAppUrl.concat(path) : webAppUrl.concat("/").concat(path);
}
origin: com.haulmont.cuba/cuba-global

@Inject
public void setConfiguration(Configuration configuration) {
  tempDir = configuration.getConfig(GlobalConfig.class).getTempDir();
}
origin: com.haulmont.cuba/cuba-core

  @Deprecated
  protected void copyParamsToCredentials(Map<String, Object> params, AbstractClientCredentials credentials) {
    // for compatibility only
    Object clientType = params.get(ClientType.class.getName());
    if (clientType != null && credentials.getClientType() == null) {
      credentials.setClientType(ClientType.valueOf((String) clientType));
    }
    Object clientInfo = params.get(SessionParams.CLIENT_INFO.getId());
    if (clientInfo != null && credentials.getClientInfo() == null) {
      credentials.setClientInfo((String) clientInfo);
    }
    Object ipAddress = params.get(SessionParams.IP_ADDRESS.getId());
    if (ipAddress != null && credentials.getIpAddress() == null) {
      credentials.setIpAddress((String) ipAddress);
    }
    Object hostName = params.get(SessionParams.HOST_NAME.getId());
    if (hostName != null) {
      credentials.setHostName((String) hostName);
    }
    if (!globalConfig.getLocaleSelectVisible()) {
      credentials.setOverrideLocale(false);
    }
  }
}
origin: com.haulmont.cuba/cuba-web

protected Locale resolveLocale(@Nullable Locale requestLocale) {
  Map<String, Locale> locales = globalConfig.getAvailableLocales();
  if (globalConfig.getLocaleSelectVisible()) {
    String lastLocale = getCookieValue(COOKIE_LOCALE);
    if (lastLocale != null) {
      for (Locale locale : locales.values()) {
        if (locale.toLanguageTag().equals(lastLocale)) {
          return locale;
        }
      }
    }
  }
  if (requestLocale != null) {
    Locale requestTrimmedLocale = messageTools.trimLocale(requestLocale);
    if (locales.containsValue(requestTrimmedLocale)) {
      return requestTrimmedLocale;
    }
    // if not found and application locale contains country, try to match by language only
    if (!StringUtils.isEmpty(requestLocale.getCountry())) {
      Locale appLocale = Locale.forLanguageTag(requestLocale.getLanguage());
      for (Locale locale : locales.values()) {
        if (Locale.forLanguageTag(locale.getLanguage()).equals(appLocale)) {
          return locale;
        }
      }
    }
  }
  // return default locale
  return messageTools.getDefaultLocale();
}
origin: com.haulmont.cuba/cuba-core

protected String getAppName() {
  return config.getWebContextName();
}
origin: com.haulmont.cuba/cuba-global

  @Override
  public String getNodeName() {
    Configuration configuration = AppBeans.get(Configuration.NAME);
    GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);
    return globalConfig.getWebHostName() + ":" + globalConfig.getWebPort();
  }
}
origin: com.haulmont.cuba/cuba-web

public static String getControllerURL(String mapping) {
  if (mapping == null) throw new IllegalArgumentException("Mapping cannot be null");
  Configuration configuration = AppBeans.get(Configuration.NAME);
  GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class);
  StringBuilder sb = new StringBuilder(globalConfig.getWebAppUrl()).append(getControllerPrefix());
  if (!mapping.startsWith("/")) {
    sb.append("/");
  }
  sb.append(mapping);
  return sb.toString();
}
origin: com.haulmont.cuba/cuba-gui

@Inject
public void setConfiguration(Configuration configuration) {
  tempDir = configuration.getConfig(GlobalConfig.class).getTempDir();
}
origin: com.haulmont.cuba/cuba-core

@Deprecated
protected void copyParamsToCredentials(Map<String, Object> params, AbstractClientCredentials credentials) {
  // for compatibility only
  Object clientType = params.get(ClientType.class.getName());
  if (clientType != null) {
    credentials.setClientType(ClientType.valueOf((String) clientType));
  }
  Object clientInfo = params.get(SessionParams.CLIENT_INFO.getId());
  if (clientInfo != null) {
    credentials.setClientInfo((String) clientInfo);
  }
  Object ipAddress = params.get(SessionParams.IP_ADDRESS.getId());
  if (ipAddress != null) {
    credentials.setIpAddress((String) ipAddress);
  }
  Object hostName = params.get(SessionParams.HOST_NAME.getId());
  if (hostName != null) {
    credentials.setHostName((String) hostName);
  }
  if (!globalConfig.getLocaleSelectVisible()) {
    credentials.setOverrideLocale(false);
  }
  RemoteClientInfo remoteClientInfo = RemoteClientInfo.get();
  if (remoteClientInfo != null) {
    String address = remoteClientInfo.getAddress();
    if (!trustedLoginHandler.checkAddress(address)) {
      credentials.setIpAddress(address);
    }
  }
}
origin: com.haulmont.cuba/cuba-rest-api

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;
}
origin: com.haulmont.cuba/cuba-rest-api

protected Locale localeFromString(String localeStr) {
  return StringUtils.isBlank(localeStr) ?
      globalConfig.getAvailableLocales().values().iterator().next()
      : LocaleUtils.toLocale(localeStr);
}
com.haulmont.cuba.core.globalGlobalConfig

Javadoc

Configuration parameters interface used by all layers: CORE, WEB, DESKTOP.

Most used methods

  • getAvailableLocales
    Supported locales. List of locales is shown on user login.
  • getConfDir
  • getWebHostName
  • getWebPort
  • getWebAppUrl
  • getWebContextName
  • getLocaleSelectVisible
    Show locale select in LoginWindow.
  • getTempDir
  • getAllowQueryFromSelected
  • getDataDir
  • getHealthCheckResponse
  • getNumberIdCacheSize
  • getHealthCheckResponse,
  • getNumberIdCacheSize,
  • getRestRequiresSecurityToken,
  • getTestMode,
  • getUserSessionLogEnabled,
  • getAnonymousSessionId,
  • getAppFolderEditWindowClassName,
  • getCubaClasspathDirectories,
  • getDeepCopyNonPersistentReferences,
  • getDisableEscapingLikeForDataStores

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • putExtra (Intent)
  • startActivity (Activity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Socket (java.net)
    Provides a client-side TCP socket.
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Table (org.hibernate.mapping)
    A relational table
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now