
de.digitalcollections.iiif.hymir.config.CustomResponseHeaders Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iiif-server-hymir Show documentation
Show all versions of iiif-server-hymir Show documentation
Hymir is a Java based IIIF Server. It is based on "IIIF API Java Libraries" (Java implementations of the IIIF specifications, see https://github.com/dbmdz/iiif-apis).
package de.digitalcollections.iiif.hymir.config;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "custom.iiif.headers")
public class CustomResponseHeaders {
private List all = new ArrayList<>();
private HashMap> image = new HashMap<>();
private HashMap> presentation = new HashMap<>();
// custom.iiif.headers.all
public void setAll(List all) {
this.all = all;
}
public List getAll() {
return this.all;
}
// custom.iiif.headers.image
public HashMap> getImage() {
return image;
}
public void setImage(HashMap> image) {
this.image = image;
}
// custom.iiif.headers.presentation
public void setPresentation(HashMap> presentation) {
this.presentation = presentation;
}
public HashMap> getPresentation() {
return presentation;
}
public List forImageTile() {
List result = new ArrayList<>();
Optional.ofNullable(all).ifPresent(result::addAll);
Optional.ofNullable(image.get("image")).ifPresent(result::addAll);
return result;
}
public List forImageInfo() {
List result = new ArrayList<>();
Optional.ofNullable(all).ifPresent(result::addAll);
Optional.ofNullable(image.get("info")).ifPresent(result::addAll);
return result;
}
public List forPresentationManifest() {
List result = new ArrayList<>();
Optional.ofNullable(all).ifPresent(result::addAll);
Optional.ofNullable(presentation.get("manifest")).ifPresent(result::addAll);
return result;
}
public List forPresentationCollection() {
List result = new ArrayList<>();
Optional.ofNullable(all).ifPresent(result::addAll);
Optional.ofNullable(presentation.get("collection")).ifPresent(result::addAll);
return result;
}
public List forPresentationAnnotationList() {
List result = new ArrayList<>();
Optional.ofNullable(all).ifPresent(result::addAll);
Optional.ofNullable(presentation.get("annotationList")).ifPresent(result::addAll);
return result;
}
public static class ResponseHeader {
private String name;
private String value;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy