Package org.wso2.carbon.ui
Class CarbonUIUtil
- java.lang.Object
-
- org.wso2.carbon.ui.CarbonUIUtil
-
public class CarbonUIUtil extends Object
Utility class for Carbon UI
-
-
Field Summary
Fields Modifier and Type Field Description static StringQUERY_PARAM_LOCALEstatic StringSESSION_PARAM_LOCALE
-
Constructor Summary
Constructors Constructor Description CarbonUIUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StringgetAdminConsoleURL(String context)Returns url to admin console.static StringgetAdminConsoleURL(javax.servlet.http.HttpServletRequest request)Returns url to admin console.static org.osgi.framework.BundleContextgetBundleContext()static StringgetBundleResourcePath(String resourceName)static StringgetHomePage()Returns 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 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 voidsetBundleContext(org.osgi.framework.BundleContext context)static voidsetLocaleToSession(javax.servlet.http.HttpServletRequest request)static voidsetProductParam(String key, Object value)static LocaletoLocale(String localeQuery)
-
-
-
Field Detail
-
QUERY_PARAM_LOCALE
public static final String QUERY_PARAM_LOCALE
- See Also:
- Constant Field Values
-
SESSION_PARAM_LOCALE
public static final String SESSION_PARAM_LOCALE
- See Also:
- Constant Field Values
-
-
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 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
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)
-
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)
-
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 fori18nBundle- - resource bundlelanguage- - 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 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:
CarbonUIDefinitions.removeMenuDefinition(String)
-
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
-
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
-
-