@Nonnull final ClientHttpRequestFactory clientHttpRequestFactory,
@Nonnull final String styleString,
@Nonnull final MapfishMapContext mapContext) throws Throwable {
// try to load xml
final ByteSource straightByteSource = ByteSource.wrap(styleString.getBytes(Constants.DEFAULT_CHARSET));
final Optional<Style> styleOptional = tryLoadSLD(straightByteSource, null);
if (styleOptional.isPresent()) {
return styleOptional;
}
final Integer styleIndex = lookupStyleIndex(styleString).orNull();
final String styleStringWithoutIndexReference = removeIndexReference(styleString);
Function<byte[], Optional<Style>> loadFunction = new Function<byte[], Optional<Style>>() {
@Override
public Optional<Style> apply(final byte[] input) {
final ByteSource bytes = ByteSource.wrap(input);
try {
return tryLoadSLD(bytes, styleIndex);
} catch (IOException e) {
throw ExceptionUtils.getRuntimeException(e);
}