# HG changeset patch
# User robcast
# Date 1496160810 -7200
# Node ID 221685dd882a536180159de4314a7167746c082d
# Parent e198d165ce75b4beb3d9e41da4a661b93e414143
started work on CORS option for image requests.
diff -r e198d165ce75 -r 221685dd882a common/src/main/java/digilib/conf/DigilibConfiguration.java
--- a/common/src/main/java/digilib/conf/DigilibConfiguration.java Fri May 26 18:14:08 2017 +0200
+++ b/common/src/main/java/digilib/conf/DigilibConfiguration.java Tue May 30 18:13:30 2017 +0200
@@ -98,8 +98,6 @@
newParameter("iiif-prefix", "IIIF", null, 'f');
// IIIF Image API version to support (mostly relevant for info.json)
newParameter("iiif-api-version", "2.0", null, 'f');
- // set CORS header on IIIF Image API info request
- newParameter("iiif-info-cors", Boolean.TRUE, null, 'f');
// character to use as slash-replacement in IIIF identifier part
newParameter("iiif-slash-replacement", "!", null, 'f');
}
diff -r e198d165ce75 -r 221685dd882a servlet/src/main/java/digilib/conf/DigilibServletConfiguration.java
--- a/servlet/src/main/java/digilib/conf/DigilibServletConfiguration.java Fri May 26 18:14:08 2017 +0200
+++ b/servlet/src/main/java/digilib/conf/DigilibServletConfiguration.java Tue May 30 18:13:30 2017 +0200
@@ -171,6 +171,10 @@
newParameter("docudirectory-class", "digilib.io.BaseDirDocuDirectory", null, 'f');
// name of cookie with authentication token
newParameter("authn-token-cookie", "id_token", null, 'f');
+ // set CORS header on IIIF Image API info request
+ newParameter("iiif-info-cors", Boolean.TRUE, null, 'f');
+ // set CORS header on IIIF Image API image request
+ newParameter("iiif-image-cors", Boolean.TRUE, null, 'f');
}
/**
diff -r e198d165ce75 -r 221685dd882a servlet/src/main/java/digilib/servlet/ServletOps.java
--- a/servlet/src/main/java/digilib/servlet/ServletOps.java Fri May 26 18:14:08 2017 +0200
+++ b/servlet/src/main/java/digilib/servlet/ServletOps.java Tue May 30 18:13:30 2017 +0200
@@ -225,6 +225,7 @@
* The local file is copied to the OutputStream
of the
* ServletResponse
. If mt is null then the mime-type is
* auto-detected with mimeForFile.
+ *
* @param f
* Image file to be sent.
* @param mt
@@ -342,6 +343,7 @@
}
// set the content type
response.setContentType(mimeType);
+ // check content type
String respType = response.getContentType();
if (! mimeType.equals(respType)) {
// this shouldn't happen