Package org.wso2.carbon.ui
Class CarbonUIUtil
java.lang.Object
org.wso2.carbon.ui.CarbonUIUtil
Utility class for Carbon UI
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetAdminConsoleURL(String context) Returns url to admin console.static StringgetAdminConsoleURL(javax.servlet.http.HttpServletRequest request) Returns url to admin console.static org.osgi.framework.BundleContextstatic StringgetBundleResourcePath(String resourceName) static StringReturns the default management ui path.static StringReturns home page location for "Home" link in Carbon UI menu.static Stringgeti18nString(String key, String i18nBundle, String language) Returns internationalized string for supplied key.static Stringgeti18nString(String key, String i18nBundle, Locale locale) Returns internationalized string for supplied key.static StringgetIndexPageURL(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpSession httpSession) static StringgetIndexPageURL(org.wso2.carbon.base.api.ServerConfigurationService serverConfig) static LocalegetLocaleFromSession(javax.servlet.http.HttpServletRequest request) static ObjectgetProductParam(String key) Method is used to retrive product xml paramsstatic StringgetServerConfigurationProperty(String propertyName) Get a ServerConfiguration Propertystatic ObjectgetServerProxy(Object clientClassObject, Class osgiObjectClass, javax.servlet.http.HttpSession session) Deprecated.Do not use this method.static StringgetServerURL(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpSession httpSession) static StringgetServerURL(org.wso2.carbon.base.api.ServerConfigurationService serverConfig) static Stringhttps2httpURL(String url) static booleanisContextRegistered(javax.servlet.ServletConfig config, String context) static booleanReturns whether resolving absolute URL config is enabled or not.static booleanisSuperTenant(javax.servlet.http.HttpServletRequest request) static booleanisUserAuthorized(javax.servlet.http.HttpServletRequest request, String resource) This method is a helper method for checking UI permissions.static voidremoveMenuDefinition(String menuId, javax.servlet.http.HttpServletRequest request) Removed menu item from current user's session.static StringremoveTenantSpecificStringsFromURL(String requestURL) static StringresolveAdminConsoleBaseURL(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.static voidsetBundleContext(org.osgi.framework.BundleContext context) static voidsetLocaleToSession(javax.servlet.http.HttpServletRequest request) static voidsetProductParam(String key, Object value) static Locale
-
Field Details
-
QUERY_PARAM_LOCALE
- See Also:
-
SESSION_PARAM_LOCALE
- See Also:
-
-
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 clientosgiObjectClass- OSGi service classsession- 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
-
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
-
getAdminConsoleURL
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
Returns url to admin console.- Parameters:
context- Webapp context root of the Carbon webapp- Returns:
- The URL of the Admin Console
-
getServerConfigurationProperty
Get a ServerConfiguration Property- Parameters:
propertyName- Name of the property- Returns:
- the property
-
isContextRegistered
-
toLocale
-
setLocaleToSession
public static void setLocaleToSession(javax.servlet.http.HttpServletRequest request) -
getLocaleFromSession
-
geti18nString
Returns internationalized string for supplied key.- Parameters:
key- - key to look fori18nBundle- - resource bundlelanguage- - language- Returns:
- internationalized key value of key, if no value can be derived
-
geti18nString
Returns internationalized string for supplied key.- Parameters:
key- - key to look fori18nBundle- - resource bundlelocale- - 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
-
isUserAuthorized
public static boolean isUserAuthorized(javax.servlet.http.HttpServletRequest request, String resource) This method is a helper method for checking UI permissions. -
getProductParam
Method is used to retrive product xml params- Parameters:
key- = product xml key- Returns:
- product xml value
-
setProductParam
-
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
-
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 webapprequest- 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.
-