Package org.wso2.carbon.ui
Class UIResourceRegistry
- java.lang.Object
-
- org.wso2.carbon.ui.UIResourceRegistry
-
- All Implemented Interfaces:
EventListener,org.osgi.framework.ServiceListener,UIResourceProvider
public class UIResourceRegistry extends Object implements UIResourceProvider, org.osgi.framework.ServiceListener
This class acts as a registry for UI resources. JspServlet and other parties who need UI resources, use an instance of this class to load UI resources. First this class loads the requested resource from the default resourceProvider, which is the BundleBasedUIResourceProvider. If it fails, the this class loads the resource from the custom UIResourceProviders
-
-
Constructor Summary
Constructors Constructor Description UIResourceRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URLgetUIResource(String path)Returns a URL to the resource that is mapped to a specified path.Set<String>getUIResourcePaths(String path)Returns a directory-like listing of all the paths to resources within the web application whose longest sub-path matches the supplied path argument.voidinitialize(org.osgi.framework.BundleContext bundleContext)voidserviceChanged(org.osgi.framework.ServiceEvent serviceEvent)voidsetDefaultUIResourceProvider(UIResourceProvider defaultUIResourceProvider)
-
-
-
Method Detail
-
initialize
public void initialize(org.osgi.framework.BundleContext bundleContext)
-
getUIResource
public URL getUIResource(String path)
Description copied from interface:UIResourceProviderReturns a URL to the resource that is mapped to a specified path. The path must begin with a "/" and is interpreted as relative to the current context root. This method returns null if no resource is mapped to the pathname.- Specified by:
getUIResourcein interfaceUIResourceProvider- Parameters:
path- a String specifying the path to the resource- Returns:
- the resource located at the named path, or null if there is no resource at that path
-
getUIResourcePaths
public Set<String> getUIResourcePaths(String path)
Description copied from interface:UIResourceProviderReturns a directory-like listing of all the paths to resources within the web application whose longest sub-path matches the supplied path argument. Paths indicating subdirectory paths end with a '/'. The returned paths are all relative to the root of resource provider and have a leading '/'. For example, for a resource provider containing /welcome.html /WEB_INF /WEB-INF/web.xml /WEB-INF/tiles /WEB-INF/tiles/main_defs.xml getResourcePaths("/") returns {"/welcome.html", "/WEB_INF"}. getResourcePaths("/WEB_INF/") returns {"/WEB-INF/web.xml", "/WEB-INF/tiles/"}. getResourcePaths("/WEB-INF/tiles/") returns {"/WEB-INF/tiles/main_defs.xml"}.- Specified by:
getUIResourcePathsin interfaceUIResourceProvider- Parameters:
path- partial path used to match the resources, which must start with a /- Returns:
- a Set containing the directory listing, or null if there are no resources whose path begins with the supplied path.
-
setDefaultUIResourceProvider
public void setDefaultUIResourceProvider(UIResourceProvider defaultUIResourceProvider)
-
serviceChanged
public void serviceChanged(org.osgi.framework.ServiceEvent serviceEvent)
- Specified by:
serviceChangedin interfaceorg.osgi.framework.ServiceListener
-
-