diff --git a/projects/pluto/src/main/java/nl/fairspace/pluto/config/dto/PlutoConfig.java b/projects/pluto/src/main/java/nl/fairspace/pluto/config/dto/PlutoConfig.java index 55cb2daae..dff512dc6 100644 --- a/projects/pluto/src/main/java/nl/fairspace/pluto/config/dto/PlutoConfig.java +++ b/projects/pluto/src/main/java/nl/fairspace/pluto/config/dto/PlutoConfig.java @@ -48,7 +48,7 @@ public static class Storage { @Data @JsonInclude(JsonInclude.Include.NON_NULL) - public static class Service { + public static class ExternalService { @NotBlank private String name; @@ -63,7 +63,7 @@ public static class Service { private List domains = Collections.emptyList(); private Map storages = new LinkedHashMap<>(); private Map metadataSources = new LinkedHashMap<>(); - private Map services = new LinkedHashMap<>(); + private Map services = new LinkedHashMap<>(); private String downstreamServiceHealthUrl; private String staticHtmlLocation; private Map icons; diff --git a/projects/pluto/src/main/java/nl/fairspace/pluto/web/IconsResource.java b/projects/pluto/src/main/java/nl/fairspace/pluto/web/IconsResource.java index bba5c9098..32b9847c9 100644 --- a/projects/pluto/src/main/java/nl/fairspace/pluto/web/IconsResource.java +++ b/projects/pluto/src/main/java/nl/fairspace/pluto/web/IconsResource.java @@ -3,7 +3,7 @@ import java.io.IOException; import java.io.InputStream; -import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.springframework.http.ResponseEntity; @@ -17,17 +17,18 @@ @RestController @Slf4j -@AllArgsConstructor +@RequiredArgsConstructor public class IconsResource { private final PlutoConfig plutoConfig; /** - * GET /api/iconsvg/{icon_name} : returns an icon of specified name if exists. + * GET /api/iconsvg/{icon_name} : returns a svg icon of specified name if exists. + * + * @return svg icon. */ @GetMapping(value = ICONS_PATH + "{icon_name}", produces = "image/svg+xml") public ResponseEntity iconsvg(@PathVariable String icon_name) { - try { - InputStream in = getSvgIconInputStream(icon_name); + try (InputStream in = getSvgIconInputStream(icon_name)) { if (in == null || in.available() == 0) { return ResponseEntity.notFound().build(); } diff --git a/projects/pluto/src/main/java/nl/fairspace/pluto/web/MetadataSourcesResource.java b/projects/pluto/src/main/java/nl/fairspace/pluto/web/MetadataSourcesResource.java index d71efc847..8679ae360 100644 --- a/projects/pluto/src/main/java/nl/fairspace/pluto/web/MetadataSourcesResource.java +++ b/projects/pluto/src/main/java/nl/fairspace/pluto/web/MetadataSourcesResource.java @@ -34,7 +34,9 @@ public ResponseEntity> metadataSources() { .map(source -> new MetadataSourceInfo( source.getName(), source.getLabel(), - source.getName() != null ? String.format("/api/metadata-sources/%s", source.getName()) : null, + source.getName() != null + ? String.format("%s%s", METADATA_SOURCES_PATH, source.getName()) + : null, iconsResource.getIconUrl(source.getIconName()))) .collect(Collectors.toList()); return ResponseEntity.ok(metadataSources);