use of org.apache.wicket.request.resource.SharedResourceReference in project midpoint by Evolveum.
the class MidPointApplication method mountFiles.
private void mountFiles(String path, Class<?> clazz) {
try {
List<Resource> list = new ArrayList<>();
String packagePath = clazz.getPackage().getName().replace('.', '/');
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] res = resolver.getResources("classpath:" + packagePath + "/*.png");
if (res != null) {
list.addAll(Arrays.asList(res));
}
res = resolver.getResources("classpath:" + packagePath + "/*.gif");
if (res != null) {
list.addAll(Arrays.asList(res));
}
for (Resource resource : list) {
URI uri = resource.getURI();
File file = new File(uri.toString());
mountResource(path + "/" + file.getName(), new SharedResourceReference(clazz, file.getName()));
}
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't mount files", ex);
}
}
Aggregations