Class CarbonUIUtil


  • public class CarbonUIUtil
    extends Object
    Utility class for Carbon UI
    • Constructor Detail

      • CarbonUIUtil

        public CarbonUIUtil()
    • Method Detail

      • 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:
        CarbonUIDefinitions.removeMenuDefinition(String)
      • 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)