changeset 1619:221685dd882a iiif-presentation-2

started work on CORS option for image requests.
author robcast
date Tue, 30 May 2017 18:13:30 +0200
parents e198d165ce75
children 1c87dbe782ab
files common/src/main/java/digilib/conf/DigilibConfiguration.java servlet/src/main/java/digilib/conf/DigilibServletConfiguration.java servlet/src/main/java/digilib/servlet/ServletOps.java
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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');        
     }
--- 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');        
     }
 
     /**
--- 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 <code>OutputStream</code> of the
      * <code>ServletResponse</code>. 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