// if the style is already stored in ySLD format just pull it directly, otherwise encode the style
if (YsldHandler.FORMAT.equalsIgnoreCase(s.getFormat())) {
return dataDir().style(s);
}
else {
GeoServerResourceLoader rl = cat.getResourceLoader();
String path;
if( s.getWorkspace() == null ){
path = Paths.path("styles",s.getFilename());
}
else {
path = Paths.path("workspaces",s.getWorkspace().getName(),"styles",s.getFilename());
}
final Resource r = rl.get(path);
// Similar to s.getStyle() and GeoServerDataDirectory.parsedStyle(s)
// But avoid resolving external graphics to absolute file references
if ( r == null || r.getType() == Type.UNDEFINED ){
throw new IOException( "No such resource: " + s.getFilename());