# HG changeset patch # User robcast # Date 1456392114 -3600 # Node ID b084694ec6182b4fb764899a30c05dbb4a2380ea # Parent 43614b59adf8720cc2ec50a096b229c00d7f81b0# Parent ef98becd15b1626010d8d1166f4214f22b87fee6 Merge from default ef98becd15b1626010d8d1166f4214f22b87fee6 diff -r 43614b59adf8 -r b084694ec618 .hgignore --- a/.hgignore Fri Nov 13 17:38:04 2015 +0100 +++ b/.hgignore Thu Feb 25 10:21:54 2016 +0100 @@ -119,4 +119,14 @@ syntax: regexp ^doc/\.project$ syntax: regexp -^doc/target$ \ No newline at end of file +^doc/target$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.cookie-range\.min\.js$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.digilib-basic\.min\.js$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.digilib-basic\.css$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.digilib-basic\.js$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.digilib-basic\.min\.css$ \ No newline at end of file diff -r 43614b59adf8 -r b084694ec618 common/src/main/java/digilib/conf/DigilibConfiguration.java --- a/common/src/main/java/digilib/conf/DigilibConfiguration.java Fri Nov 13 17:38:04 2015 +0100 +++ b/common/src/main/java/digilib/conf/DigilibConfiguration.java Thu Feb 25 10:21:54 2016 +0100 @@ -57,7 +57,7 @@ /** digilib version */ public static String getClassVersion() { - return "2.3.7"; + return "2.3.8"; } /* non-static getVersion for Java inheritance */ diff -r 43614b59adf8 -r b084694ec618 common/src/main/java/digilib/image/ImageJobDescription.java --- a/common/src/main/java/digilib/image/ImageJobDescription.java Fri Nov 13 17:38:04 2015 +0100 +++ b/common/src/main/java/digilib/image/ImageJobDescription.java Thu Feb 25 10:21:54 2016 +0100 @@ -183,6 +183,30 @@ } /** + * Creates new ImageJobDescription by merging Parameters from a + * DigilibRequest and adding an ImageSEt. + * + * @param dlReq + * @param imgs + * @param dlcfg + * @return + * @throws ImageOpException + * @throws IOException + */ + public static ImageJobDescription getInstanceWithImgs(DigilibRequest dlReq, ImageSet imgs, DigilibConfiguration dlcfg) + throws IOException, ImageOpException { + ImageJobDescription newMap = new ImageJobDescription(dlcfg); + // add all params to this map + newMap.params.putAll(dlReq.getParams()); + newMap.initOptions(); + newMap.setImageSet(imgs); + newMap.prepareScaleParams(); + // add ImageJobDescription back into DigilibRequest + dlReq.setJobDescription(newMap); + return newMap; + } + + /** * Creates new ImageJobDescription by merging Parameters from another * ParameterMap. * @@ -747,6 +771,14 @@ return imgSize; } + /** + * Set the image size. + * + * @param size + */ + public void setImgSize(ImageSize size) { + this.imgSize = size; + } /** * Return the X scale factor. diff -r 43614b59adf8 -r b084694ec618 doc/src/site/markdown/scaler-api.md --- a/doc/src/site/markdown/scaler-api.md Fri Nov 13 17:38:04 2015 +0100 +++ b/doc/src/site/markdown/scaler-api.md Thu Feb 25 10:21:54 2016 +0100 @@ -6,7 +6,7 @@ Unknown parameters will be silently ignored. -Recognised parameters (as of Version 2.2.2, for the most recent list of +Recognised parameters (as of Version 2.3.7, for the most recent list of parameters [use the source](https://sourceforge.net/p/digilib/code/ci/default/tree/servlet/src/main/java/digilib/conf/DigilibServletRequest.java) ): @@ -58,13 +58,16 @@ `osize` mode. - `scale`: absolute scale factor applied to the highest resolution image for `ascale` mode. -- `colop`: color operation. One of "GRAYSCALE" (produces grayscale - image), "NTSC\_GRAY" (uses NTSC formula to produce grayscale image), - "INVERT" (inverts colors), "MAP\_GRAY\_BGR" (produces false-color image - mapping brightness values to color scale from blue via green to red). +- `colop`: color operation. One of + - `GRAYSCALE` (produces grayscale image) + - `NTSC_GRAY` (uses NTSC formula to produce grayscale image) + - `BITONAL` (produces black-and-white image) + - `INVERT` (inverts colors) + - `MAP_GRAY_BGR` (produces false-color image mapping brightness values to color scale from blue via green to red). - `mo`: list of flags for the mode of operation separated by comma ",". - - `fit`: always scale the image to fit \[`dw` x `dh`\] (default). - - `clip`: send the file in its original resolution, cropped + - `fit`: scale the image proportionally to fit inside \[`dw` x `dh`\], preserving its aspect ratio (default). + - `squeeze`: scale the image to fit \[`dw` x `dh`\], changing its aspect ratio. + - `clip`: send the file in the highest resolution, cropped to fit \[`dw` x `dh`\]. - `osize`: scale to original size based on image resolution (from the image metadata) and display resolution @@ -81,14 +84,16 @@ - `errcode`: send error response as HTTP status code. - `q0`-`q2`: quality of interpolation in scaling (q0: worst, q2 best). - - `lores`: try to use pre-scaled images (default) - `hires`: only use the highest resolution image. + - `autores`: use the pre-scaled image that is bigger than the requested size (default). + - `lores`: prefer the next-smaller pre-scaled image. - `vmir`: mirror image vertically. - `hmir`: mirror image horizontally. - `jpg`: the resulting image is always sent as JPEG (otherwise TIFF and PNG images are sent as PNG). - `png`: the resulting image is always sent as PNG (otherwise JPEG and J2K images are sent as JPEG). + - `pxarea`: interpret `wx`, `wy`, `ww`, `wh` as pixel coordinates on the highest resolution image. The image to be loaded is specified by the `request_path` (deprecated) and/or the `fn` parameter (preferred) and the optional @@ -102,9 +107,9 @@ Find more information on the directory layout [here](image-directories.html). The image will always be scaled equally in horizontal and vertical direction, -preserving the aspect ratio, +preserving the aspect ratio (except with `mo=squeeze`), such that the resulting image does not exceed the rectangle \[`dw` x `dh`\]. If only either height or width is given the image is scaled to match only the given dimension. The size of the resulting image in the other -dimension is determined by the aspect ratio of the image. +dimension is determined by the aspect ratio of the image or the selected area. diff -r 43614b59adf8 -r b084694ec618 servlet/src/main/java/digilib/auth/MetaAccessServletAuthOps.java --- a/servlet/src/main/java/digilib/auth/MetaAccessServletAuthOps.java Fri Nov 13 17:38:04 2015 +0100 +++ b/servlet/src/main/java/digilib/auth/MetaAccessServletAuthOps.java Thu Feb 25 10:21:54 2016 +0100 @@ -42,7 +42,6 @@ import digilib.io.DocuDirCache; import digilib.io.DocuDirent; import digilib.io.FileOpException; -import digilib.io.FileOps; import digilib.meta.MetadataMap; import digilib.util.HashTree; import digilib.util.XMLListLoader; @@ -50,9 +49,28 @@ /** * Implementation of AuthOps using "access" information from file metadata and * roles mapped to IP-number ranges defined in an XML config file. + *
+ * Tags "digilib-access" and "digilib-adresses" are read from the configuration file: + *+ * {@code + *+ * A user must supply one of the roles under "role" to access any object with the metadata "access" type of "type". + * Roles under "role" must be separated by comma only (no spaces). + *+ * + * } + *+ *
+ * {@code + *+ * A computer with an ip address that matches "ip" is automatically granted all roles under "role". + * The ip address is matched from the left (in full quads). Roles under "role" must be separated by comma only (no spaces). * - * The configuration file is read by an XMLListLoader into HashTree objects for - * IP numbers. */ public class MetaAccessServletAuthOps extends ServletAuthOpsImpl { @@ -74,9 +92,10 @@ } /** - * Initialize. + * Initialize authentication operations. * - * Read configuration files and setup authorization arrays. + * Reads tags "digilib-access" and "digilib-adresses" from configuration file + * and sets up authentication arrays. * * @throws AuthOpException * Exception thrown on error. @@ -136,7 +155,7 @@ // try to get image file from DirCache DigilibConfiguration config = dlRequest.getDigilibConfig(); DocuDirCache cache = (DocuDirCache) config.getValue(DigilibServletConfiguration.DIR_CACHE_KEY); - imgs = cache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), FileOps.FileClass.IMAGE); + imgs = cache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn")); } } catch (FileOpException e) { throw new AuthOpException("No file for auth check!"); diff -r 43614b59adf8 -r b084694ec618 servlet/src/main/java/digilib/auth/PathServletAuthOps.java --- a/servlet/src/main/java/digilib/auth/PathServletAuthOps.java Fri Nov 13 17:38:04 2015 +0100 +++ b/servlet/src/main/java/digilib/auth/PathServletAuthOps.java Thu Feb 25 10:21:54 2016 +0100 @@ -37,10 +37,29 @@ import digilib.util.XMLListLoader; /** - * Implementation of AuthOps using paths defined in an XML config file. + * Implements AuthOps using paths defined in an XML config file. + * + * Tags "digilib-paths" and "digilib-adresses" are read from the configuration file: + *+ * + * + * + * } + *
+ * {@code + *+ * A user must supply one of the roles under "role" to access the directory "name". + * Roles under "role" must be separated by comma only (no spaces). + *+ * + * } + *+ *
+ * {@code + *+ * A computer with an ip address that matches "ip" is automatically granted all roles under "role". + * The ip address is matched from the left (in full quads). Roles under "role" must be separated by comma only (no spaces). * - * The configuration file is read by an XMLListLoader into HashTree objects for - * authentication paths and IP numbers. */ public class PathServletAuthOps extends ServletAuthOpsImpl { @@ -62,9 +81,10 @@ } /** - * Initialize. + * Initialize authentication operations. * - * Read configuration files and setup authentication arrays. + * Reads tags "digilib-paths" and "digilib-adresses" from configuration file + * and sets up authentication arrays. * * @throws AuthOpException * Exception thrown on error. @@ -95,15 +115,13 @@ /** * Return authorization roles needed for request. * - * Returns the list of authorization roles that are needed to access the + * Returns the list of authorization roles that are required to access the * specified path. No list means the path is free. * - * The location information of the request is also considered. + * The location information of the request is determined by ServletRequest.getRemoteAddr(). * - * @param filepath - * filepath to be accessed. - * @param request - * ServletRequest with address information. + * @param dlRequest + * DigilibServletRequest with image path and remote address information. * @throws AuthOpException * Exception thrown on error. * @return List of Strings with role names. diff -r 43614b59adf8 -r b084694ec618 servlet/src/main/java/digilib/servlet/ServletOps.java --- a/servlet/src/main/java/digilib/servlet/ServletOps.java Fri Nov 13 17:38:04 2015 +0100 +++ b/servlet/src/main/java/digilib/servlet/ServletOps.java Thu Feb 25 10:21:54 2016 +0100 @@ -446,7 +446,7 @@ writer.println("{"); writer.println("\"@context\" : \"http://iiif.io/api/image/2/context.json\","); writer.println("\"@id\" : \"" + url + "\","); - writer.println("\"@protocol\" : \"http://iiif.io/api/image\","); + writer.println("\"protocol\" : \"http://iiif.io/api/image\","); writer.println("\"width\" : " + size.width + ","); writer.println("\"height\" : " + size.height + ","); writer.println("\"profile\" : ["); diff -r 43614b59adf8 -r b084694ec618 webapp/pom.xml --- a/webapp/pom.xml Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/pom.xml Thu Feb 25 10:21:54 2016 +0100 @@ -14,6 +14,7 @@+ * + * + * + * } + *
digilib doesn't work! Please switch on Javascript or notify the server administrator!
+