@RequestMapping(value = "/module/config", method = RequestMethod.GET)
@ResponseBody
public List<ModuleConfig> getConfig() throws IOException {
List<ModuleConfig> configuration = new ArrayList<>();
for (Bundle bundle : bundleContext.getBundles()) {
ModuleRegistrationData data = uiFrameworkService.getModuleDataByBundle(bundle);
if (null != data) {
Map<String, String> scripts = findScripts(bundle);
for (Map.Entry<String, String> script : scripts.entrySet()) {
addConfig(configuration, script.getKey(), getPath(data, script.getValue()));
}
List<String> angularModules = data.getAngularModules();
String name = isEmpty(angularModules) ? null : angularModules.get(0);
List<URL> css = cast(URL.class, bundle.findEntries("/webapp/css/", "*.css", true));
String cssPath = null;
if (!css.isEmpty() && !bundle.getSymbolicName().equalsIgnoreCase("org.motechproject.motech-platform-server-bundle")) {
cssPath = getPath(data, getCSSPath(css.get(0)));
}
addConfig(configuration, name, getPath(data, "/js/app.js"), data.getUrl(), cssPath);
}
}
return configuration;
}