Class CarbonUIUtil

java.lang.Object
org.wso2.carbon.ui.CarbonUIUtil

public class CarbonUIUtil extends Object
Utility class for Carbon UI
  • Field Details

  • Constructor Details

    • CarbonUIUtil

      public CarbonUIUtil()
  • Method Details

    • getServerProxy

      public static Object getServerProxy(Object clientClassObject, Class osgiObjectClass, javax.servlet.http.HttpSession session)
      Deprecated.
      Do not use this method. Simply use the relevant client.
      Get a proxy object to the business logic implementation class.

      This proxy could be a handle to an OSGi service or a Web services client

      Parameters:
      clientClassObject - Web services client
      osgiObjectClass - OSGi service class
      session - The HTTP Session
      Returns:
      Proxy object
    • setBundleContext

      public static void setBundleContext(org.osgi.framework.BundleContext context)
    • getBundleContext

      public static org.osgi.framework.BundleContext getBundleContext()
    • getIndexPageURL

      public static String getIndexPageURL(org.wso2.carbon.base.api.ServerConfigurationService serverConfig)
    • getIndexPageURL

      public static String getIndexPageURL(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpSession httpSession)
    • getServerURL

      public static String getServerURL(org.wso2.carbon.base.api.ServerConfigurationService serverConfig)
    • getServerURL

      public static String getServerURL(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpSession httpSession)
    • isSuperTenant

      public static boolean isSuperTenant(javax.servlet.http.HttpServletRequest request)
    • https2httpURL

      public static String https2httpURL(String url)
    • getAdminConsoleURL

      public static String getAdminConsoleURL(javax.servlet.http.HttpServletRequest request)
      Returns url to admin console. eg: https://192.168.1.201:9443/wso2/carbon
      Parameters:
      request - The HTTPServletRequest
      Returns:
      The URL of the Admin Console
    • getAdminConsoleURL

      public static String getAdminConsoleURL(String context)
      Returns url to admin console.
      Parameters:
      context - Webapp context root of the Carbon webapp
      Returns:
      The URL of the Admin Console
    • getServerConfigurationProperty

      public static String getServerConfigurationProperty(String propertyName)
      Get a ServerConfiguration Property
      Parameters:
      propertyName - Name of the property
      Returns:
      the property
    • isContextRegistered

      public static boolean isContextRegistered(javax.servlet.ServletConfig config, String context)
    • toLocale

      public static Locale toLocale(String localeQuery)
    • setLocaleToSession

      public static void setLocaleToSession(javax.servlet.http.HttpServletRequest request)
    • getLocaleFromSession

      public static Locale getLocaleFromSession(javax.servlet.http.HttpServletRequest request)
    • geti18nString

      public static String geti18nString(String key, String i18nBundle, String language)
      Returns internationalized string for supplied key.
      Parameters:
      key - - key to look for
      i18nBundle - - resource bundle
      language - - language
      Returns:
      internationalized key value of key, if no value can be derived
    • geti18nString

      public static String geti18nString(String key, String i18nBundle, Locale locale)
      Returns internationalized string for supplied key.
      Parameters:
      key - - key to look for
      i18nBundle - - resource bundle
      locale - - locale
      Returns:
      internationalized key value of key, if no value can be derived
    • removeMenuDefinition

      public static void removeMenuDefinition(String menuId, javax.servlet.http.HttpServletRequest request)
      Removed menu item from current user's session. Only current user's menu items are effected.
      Parameters:
      menuId -
      request -
      See Also:
    • getBundleResourcePath

      public static String getBundleResourcePath(String resourceName)
    • isUserAuthorized

      public static boolean isUserAuthorized(javax.servlet.http.HttpServletRequest request, String resource)
      This method is a helper method for checking UI permissions.
    • getProductParam

      public static Object getProductParam(String key)
      Method is used to retrive product xml params
      Parameters:
      key - = product xml key
      Returns:
      product xml value
    • setProductParam

      public static void setProductParam(String key, Object value)
    • getHomePage

      public static String getHomePage()
      Returns home page location for "Home" link in Carbon UI menu. If defaultHomePage property is available in product.xml this method will return it and if not it'll return default ../admin/index.jsp
      Returns:
      home page location
    • removeTenantSpecificStringsFromURL

      public static String removeTenantSpecificStringsFromURL(String requestURL)
    • getDefaultManagementUIPath

      public static String getDefaultManagementUIPath()
      Returns the default management ui path.
      Returns:
      default management ui path
    • resolveAdminConsoleBaseURL

      public static String resolveAdminConsoleBaseURL(String context, String relativePath, javax.servlet.http.HttpServletRequest request)
      Returns absolute URL of admin console webapp for given relative path if IS_RESOLVE_ABSOLUTE_URLS_ENABLED config is enabled.
      Parameters:
      context - Webapp context root of the Carbon webapp.
      relativePath - Relative path of the Carbon webapp
      request - Request that used to redirect.
      Returns:
      absolute URL of admin console webapp for given relative path.
    • isResolveAbsoluteURLsEnabled

      public static boolean isResolveAbsoluteURLsEnabled()
      Returns whether resolving absolute URL config is enabled or not.
      Returns:
      Resolving absolute URL config is enabled.