我正在尝试获取资源路径 /_system/governance/trunk/services 中的服务列表。所以最初我试图使用注册表 api 获取资源。我尝试了两种方式。一种方法是
`CarbonContext cCtx = CarbonContext.getCurrentContext();
Registry registry = cCtx.getRegistry(RegistryType.SYSTEM_CONFIGURATION);
String registryType = request.getParameter("registryType");
if(registryType != null) {
registry = cCtx.getRegistry(RegistryType.valueOf(registryType));
}
String resourcePath = "/_system/governance/trunk/services";
try{
if(registry.resourceExits(resourcePath)){
Resource resource = registry.get(resourcePath);
}
}catch(Exception e){
out.print(e.getMessage());
}`
使用 ServiceManager 的另一种方法,我在初始化 ServiceManager 的第一步失败
'CarbonContext cCtx = CarbonContext.getCurrentContext();
Registry registry = cCtx.getRegistry(RegistryType.SYSTEM_CONFIGURATION);
String registryType = request.getParameter("registryType");
if(registryType != null) {
registry = cCtx.getRegistry(RegistryType.valueOf(registryType));
out.print(" Registry got Initialised ! ");
}
java.util.List<Resource> result = new java.util.ArrayList<Resource>();
String resourcePath = "/_system/governance/trunk/services";
ServiceManager serviceManager = new ServiceManager(registry);'
那么我需要做什么来获取 index.jsp 中所有服务的列表并且我正在使用二进制代码?