if ( styleResource.getType() == Type.UNDEFINED ){
throw new IOException( "No such resource: " + s.getFilename());
}
File input = styleResource.file();
DefaultResourceLocator locator = new DefaultResourceLocator() {
@Override
public URL locateResource(String uri) {
URL url = super.locateResource(uri);
if(url.getProtocol().equalsIgnoreCase("resource")) {
return fileToUrlPreservingCqlTemplates(urlToResource(url).file());
} else {
return url;
}
}
};
locator.setSourceUrl(resourceToUrl(styleResource));
final StyledLayerDescriptor sld =
Styles.handler(s.getFormat()).parse(input, s.getFormatVersion(), locator, null);
final Style style = Styles.style(sld);
assert style!=null;