Mercurial > hg > digilib
changeset 1660:75a74f7045b4
Merge branch 'master' into release-2.5
Conflicts:
common/src/main/java/digilib/conf/DigilibConfiguration.java
author | Robert Casties <r0bcas7@gmail.com> |
---|---|
date | Tue, 21 Nov 2017 15:18:31 +0100 |
parents | dc440131299b (current diff) 28df291d4e26 (diff) |
children | cf9dcddf4ec6 |
files | common/pom.xml common/src/main/java/digilib/conf/DigilibConfiguration.java doc/pom.xml iiif-presentation/pom.xml pdf/pom.xml pom.xml servlet/pom.xml text/pom.xml webapp/pom.xml webapp/src/main/webapp/jquery/digilib-dbg.html |
diffstat | 26 files changed, 752 insertions(+), 347 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Tue Nov 21 15:18:31 2017 +0100 @@ -0,0 +1,7 @@ +/.project +/*/.project +/target/ +/*/target/ +/.settings/ +/*/.settings/ +/*/.classpath
--- a/README.md Mon Jun 12 16:08:27 2017 +0200 +++ b/README.md Tue Nov 21 15:18:31 2017 +0100 @@ -28,11 +28,36 @@ ## Where can I get digilib? -`digilib` source code, binaries and documentation can be found on the -[digilib project pages](https://sourceforge.net/projects/digilib/) -on [SourceForge](https://sourceforge.net/): - -* [Source code](https://sourceforge.net/p/digilib/code/ci/default/tree/) +* [Source code](https://github.com/robcast/digilib) +* [Issue tracker](https://github.com/robcast/digilib/issues) * Daily built [WAR files](https://it-dev.mpiwg-berlin.mpg.de/downloads/digilib/daily-build/) * Daily built [Javadoc](https://it-dev.mpiwg-berlin.mpg.de/downloads/digilib/daily-build/javadoc/) * [Maven repository](http://it-dev.mpiwg-berlin.mpg.de/maven-repo/) + +`digilib` documentation can be found on the +[digilib documentation pages](https://robcast.github.io/digilib/) on GitHub +or on [SourceForge](http://digilib.sourceforge.net). + +## How do I run digilib? + +Requirements: +* [git](https://git-scm.com/) +* [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) version 7 or later +* [Maven](https://maven.apache.org/) version 3 or later + +Build: +1. Clone the digilib repository + + `git clone https://github.com/robcast/digilib.git` + +2. Change to the repository + + `cd digilib` + +3. build and run the webapp in the embedded Jetty runtime for development + + `mvn jetty:run-exploded --projects webapp` + + and watch digilib at http://localhost:8080/digilib/digilib.html + +or follow the build and install instructions on the [documentation pages](https://robcast.github.io/digilib/).
--- a/common/pom.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/common/pom.xml Tue Nov 21 15:18:31 2017 +0100 @@ -12,7 +12,7 @@ <artifactId>digilib-common</artifactId> <name>digilib-common</name> <description>The Digital Image Library - common library</description> - <url>http://digilib.sourceforge.net</url> + <url>https://github.com/robcast/digilib</url> <packaging>jar</packaging> <profiles>
--- a/common/src/main/java/digilib/conf/DigilibConfiguration.java Mon Jun 12 16:08:27 2017 +0200 +++ b/common/src/main/java/digilib/conf/DigilibConfiguration.java Tue Nov 21 15:18:31 2017 +0100 @@ -57,7 +57,11 @@ /** digilib version */ public static String getClassVersion() { +<<<<<<< HEAD return "2.5.3"; +======= + return "2.5.4a"; +>>>>>>> refs/heads/master } /* non-static getVersion for Java inheritance */
--- a/common/src/main/java/digilib/image/DocuImage.java Mon Jun 12 16:08:27 2017 +0200 +++ b/common/src/main/java/digilib/image/DocuImage.java Tue Nov 21 15:18:31 2017 +0100 @@ -318,4 +318,20 @@ * @param hackString */ public void setHacks(String hackString); + + /** + * Set optional image specific hints with additional information. + * + * @param key + * @param value + */ + public void setHint(String key, Object value); + + /** + * Returns the image specific hint with the given key. + * + * @param key + * @return + */ + public Object getHint(String key); }
--- a/common/src/main/java/digilib/image/DocuImageImpl.java Mon Jun 12 16:08:27 2017 +0200 +++ b/common/src/main/java/digilib/image/DocuImageImpl.java Tue Nov 21 15:18:31 2017 +0100 @@ -30,9 +30,11 @@ import java.awt.Rectangle; import java.io.IOException; import java.io.OutputStream; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Map; import org.apache.log4j.Logger; @@ -68,6 +70,9 @@ /** ImageInput that was read */ protected ImageInput input; + + /** image specific hints */ + protected Map<String, Object> hints = new HashMap<String, Object>(); /** * Returns the version. @@ -228,4 +233,20 @@ // doing nothing } + /* (non-Javadoc) + * @see digilib.image.DocuImage#setHint(java.lang.String, java.lang.Object) + */ + @Override + public void setHint(String key, Object value) { + hints.put(key, value); + } + + /* (non-Javadoc) + * @see digilib.image.DocuImage#getHint(java.lang.String) + */ + @Override + public Object getHint(String key) { + return hints.get(key); + } + }
--- a/common/src/main/java/digilib/io/FileOps.java Mon Jun 12 16:08:27 2017 +0200 +++ b/common/src/main/java/digilib/io/FileOps.java Tue Nov 21 15:18:31 2017 +0100 @@ -295,6 +295,23 @@ return pathname.substring(a, e + 1); } + + /** + * Returns if the filename is valid. + * + * Currently only checks if filename starts with a dot. + * + * @param filename + * @return + */ + public static boolean isValidFilename(String filename) { + // exclude filenames starting with a dot + if (filename.startsWith(".")) { + return false; + } + return true; + } + /** * FileFilter for general files */ @@ -311,7 +328,11 @@ static class ImageFileFilter implements FileFilter { public boolean accept(File f) { - return (classForFilename(f.getName()) == FileClass.IMAGE); + String fn = f.getName(); + if (isValidFilename(fn)) { + return (classForFilename(fn) == FileClass.IMAGE); + } + return false; } } @@ -320,9 +341,13 @@ */ static class TextFileFilter implements FileFilter { - public boolean accept(File f) { - return (classForFilename(f.getName()) == FileClass.TEXT); - } + public boolean accept(File f) { + String fn = f.getName(); + if (isValidFilename(fn)) { + return (classForFilename(fn) == FileClass.TEXT); + } + return false; + } } /** @@ -331,9 +356,13 @@ */ static class SVGFileFilter implements FileFilter { - public boolean accept(File f) { - return (classForFilename(f.getName()) == FileClass.SVG); - } + public boolean accept(File f) { + String fn = f.getName(); + if (isValidFilename(fn)) { + return (classForFilename(fn) == FileClass.SVG); + } + return false; + } } /**
--- a/common/src/main/java/digilib/meta/IndexMetaAuthLoader.java Mon Jun 12 16:08:27 2017 +0200 +++ b/common/src/main/java/digilib/meta/IndexMetaAuthLoader.java Tue Nov 21 15:18:31 2017 +0100 @@ -1,20 +1,5 @@ package digilib.meta; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URI; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.log4j.Logger; - /* * #%L * IndexMetaAuthLoader -- Load XML format metadata into MetadataMaps @@ -41,6 +26,21 @@ * Author: Robert Casties (robcast@users.sourceforge.net) */ +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.log4j.Logger; + /** * Class loading index.meta files extracting image file related information. * @@ -85,12 +85,13 @@ protected String metaTag = "meta"; protected String fileTag = "file"; - protected String[] fileNameTag = {"file", "name"}; - protected String[] filePathTag = {"file", "path"}; - protected String[] fileMetaTag = {"file", "meta"}; + protected String[] fileNamePath = {"file", "name"}; + protected String[] filePathPath = {"file", "path"}; + protected String[] fileMetaPath = {"file", "meta"}; protected String imgTag = "img"; - protected String[] accessTag = {"access-conditions", "access"}; - protected String[] accessNameTag = {"access", "name"}; + protected String accessTag = "access"; + protected String[] accessPath = {"access-conditions", "access"}; + protected String[] accessNamePath = {"access", "name"}; private XMLStreamReader reader; private LinkedList<String> tags; @@ -137,7 +138,7 @@ /* * meta tag - read contents in new meta map */ - if (tagsMatchPath(fileMetaTag)) { + if (tagsMatchPath(fileMetaPath)) { fileMeta = readMetaTag(new MetadataMap()); } else { otherMeta = readMetaTag(new MetadataMap()); @@ -171,12 +172,12 @@ // save meta in file list files.put(fn, fileMeta); } - } else if (tagsMatchPath(fileNameTag)) { + } else if (tagsMatchPath(fileNamePath)) { /* * file/name tag - record name */ filename = text.toString(); - } else if (tagsMatchPath(filePathTag)) { + } else if (tagsMatchPath(filePathPath)) { /* * file/path tag - record path */ @@ -239,7 +240,7 @@ StringBuffer text = new StringBuffer(); String accType = null; String accName = null; - if (tagsMatchPath(accessTag)) { + if (tagsMatchPath(accessPath)) { // read attribute from current access tag accType = reader.getAttributeValue(null, "type"); } @@ -258,12 +259,12 @@ } else if (event == XMLStreamConstants.CHARACTERS) { text.append(reader.getText()); } else if (event == XMLStreamConstants.END_ELEMENT) { - if (tagsMatchPath(accessNameTag)) { + if (tagsMatchPath(accessNamePath)) { /* * access/name tag */ accName = text.toString(); - } else if (tagsMatchPath(accessTag)) { + } else if (tagsMatchPath(accessPath)) { /* * access tag - we're done */ @@ -305,7 +306,7 @@ * img tag */ map = readTagToMap(map); - } else if (tagsMatchPath(accessTag)) { + } else if (tagsMatchPath(accessPath)) { /* * access tag */
--- a/doc/pom.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/doc/pom.xml Tue Nov 21 15:18:31 2017 +0100 @@ -9,7 +9,7 @@ <packaging>pom</packaging> <name>digilib-doc</name> <description>The Digital Image Library - documentation</description> - <url>http://digilib.sourceforge.net</url> + <url>https://github.com/robcast/digilib</url> <build> <plugins> <plugin> @@ -24,6 +24,25 @@ </dependency> </dependencies> </plugin> + <plugin> + <groupId>com.github.github</groupId> + <artifactId>site-maven-plugin</artifactId> + <version>0.12</version> + <configuration> + <repositoryName>digilib</repositoryName> + <repositoryOwner>robcast</repositoryOwner> + <server>github</server> + <message>Creating site for ${project.version}</message> + </configuration> + <executions> + <execution> + <goals> + <goal>site</goal> + </goals> + <phase>site</phase> + </execution> + </executions> + </plugin> </plugins> </build> <reporting>
--- a/doc/src/site/markdown/build-maven.md Mon Jun 12 16:08:27 2017 +0200 +++ b/doc/src/site/markdown/build-maven.md Tue Nov 21 15:18:31 2017 +0100 @@ -1,34 +1,30 @@ # Building digilib with Maven -The easiest way to get the latest and greatest digilib is the [Maven](http://maven.apache.org/) build tool. -It will download, compile, and install the latest digilib version and all required libraries. +The best way to get the latest and greatest digilib is using the [git](https://git-scm.com/) version control and the [Maven](http://maven.apache.org/) build tool. +Git will download the digilib code and Maven will compile, and install the latest digilib version and all required libraries. ## What you need -* [Java](http://www.java.com/) (1.5 or higher) +* [git](https://git-scm.com/) +* [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (7 or higher) * [Maven](http://maven.apache.org/) -* [Mercurial](http://mercurial.selenic.com/) -* A Servlet container like [Tomcat](http://tomcat.apache.org/) -or [Jetty](http://www.eclipse.org/jetty/) to run the web application. -## Quick build +## Quick developer build and run -The fastest way to build the digilib web application is to download the digilib -project file [pom.xml](https://sourceforge.net/p/digilib/code/ci/default/tree/pom.xml?format=raw) -(download and save it) and run - - mvn scm:bootstrap -N - -in the same directory as the `pom.xml` file. +1. Clone the digilib repository into a directory `digilib` + + git clone https://github.com/robcast/digilib.git + +2. Change to the directory + + cd digilib + +3. build and run the webapp in the embedded Jetty runtime for development + + mvn jetty:run-exploded --projects webapp + + and watch your digilib at http://localhost:8080/digilib.html -This will create a web application directory `digilib-webapp-2.2-SNAPSHOT` -and a WAR file `digilib-webapp-2.2-SNAPSHOT-srv3.war` (or similar) -in the subdirectory `target/checkout/webapp/target/` - -Digilib uses the Asynchronous Servlet API (3.0) by default. You will need Java version 6 -and Tomcat version 7 or Jetty version 8 or later to use it. -If you want to use the old non-Asynchronous Servlet API (2.3) add `-Pservlet2` -to the Maven command line above. ## Developer build @@ -38,31 +34,27 @@ To check out the latest source code into the directory `digilib` run - hg clone http://hg.code.sf.net/p/digilib/code digilib + git clone https://github.com/robcast/digilib.git + +and change into the repository directory -The digilib configuration files are now in `digilib/webapp/src/main/webapp/WEB-INF/` + cd digilib If you want to update your copy of digilib to the latest version at some time in the future just run - hg pull - hg up - -in the `digilib` directory. + git pull -To build the resulting source code, change into the `digilib` -directory you checked out above and run +The digilib configuration files are in the sub-directory `webapp/src/main/webapp/WEB-INF/` (see below). + +To build the resulting source code run mvn package -This will create a web application directory `digilib-webapp-2.2-SNAPSHOT` -and a WAR file `digilib-webapp-2.2-SNAPSHOT-srv3.war` (or similar) in +This will create a web application directory `digilib-webapp-2.5-SNAPSHOT` +and a WAR file `digilib-webapp-2.5-SNAPSHOT-srv3.war` (or similar) in the subdirectory `webapp/target/` . -Digilib uses the Asynchronous Servlet API (3.0) by default. You will need Java version 6 -and Tomcat version 7 or Jetty version 8 or later to use it. -If you want to use the old non-Asynchronous Servlet API (2.3) add `-Pservlet2` -to the Maven command line above. ## Deploying the web application by hand @@ -72,20 +64,32 @@ Since the URL of your digilib server starts with the name of the web application and the name of the web application is derived from the name of the web application directory or the WAR file **please rename the web application directory or WAR file -to `digitallibrary` before you start** +to `digilib` before you start** -Then you should see your digilib running at the URL -[http://localhost:8080/digitallibrary/jquery/digilib.html](http://localhost:8080/digitallibrary/jquery/digilib.html) +Then you should see digilib running at the URL +http://localhost:8080/digilib/digilib.html If you use the unmodified default configuration you should see the digilib logo and other sample images from the `sample-images` directory of the web application. +For more detailed documentation see the [deployment instructions](install-digilib.html). + ## Configuring digilib -To change the configuration of digilib just edit the file `digilib-config.xml` -in the web application directory (`digitallibrary/WEB-INF/digilib-config.xml`). -Documentation of the configuration options is [here](digilib-config.html). +To change the configuration of digilib just create and edit the file `digilib-config.xml` +in the web application WEB-INF directory (`webapp/src/main/webapp/WEB-INF/digilib-config.xml`). +You can copy and rename the sample file `digilib-config.xml.template` to get some default options to start with. +Please check the [documentation of the configuration options](digilib-config.html). You can see a summary of your running digilib configuration at the URL -[http://localhost:8080/digitallibrary/server/dlConfig.jsp](http://localhost:8080/digitallibrary/server/dlConfig.jsp) +http://localhost:8080/digilib/server/dlConfig.jsp + +## Additional Maven build options + +### servlet2 +Digilib uses the Asynchronous Servlet API (3.0) by default. You will need Java version 6 or later +and Tomcat version 7 or Jetty version 8 or later to use it. +If you want to use the old non-Asynchronous Servlet API (2.3) add `-Pservlet2` +to the Maven command line above. +
--- a/doc/src/site/markdown/digilib-config.md Mon Jun 12 16:08:27 2017 +0200 +++ b/doc/src/site/markdown/digilib-config.md Tue Nov 21 15:18:31 2017 +0100 @@ -1,100 +1,272 @@ # Configuring digilib -## digilib-config.xml +The main configuration for *digilib* is the XML file `digilib-config.xml` in the +`WEB-INF` directory of the webapp. Alternatively you can also use a Java properties +file `digilib.properties` somewhere in the classpath. +(If you really need a different location for the XML file you can define it in +the `config-file` init-parameter to the Servlet. **TODO** add an example) -The main configuration for digilib is the XML file `digilib-config.xml` in the `WEB-INF` -directory in the webapp or a Java properties file `digilib.properties` somewhere in the classpath. -(If you really need a different location for the XML file you can define it in the `config-file` -init-parameter to the Servlet.) +In the configuration file you can set lots of paths and options. *digilib* uses +default values for all configuration settings that meet most requirements. +Hence you have to configure only the settings that you want to change. The +**`basedir-list`** parameter however is **mandatory** unless you only want to serve +the contributed example images for an evaluation. -In the configuration file you can set lots of paths and options. digilib uses -default values for all configuration settings that meet most requirements -so you have to configure only the settings that you want to change. +All options are defined as `parameter` elements with the attributes `name` and +`value` that are wrapped in the root element `digilib-config`. A minimal +configuration looks like this: -You have to adjust the **`basedir-list`** parameter to the directories -where your images are installed. The directory path has to be an absolute -path following the conventions of your operating system (a relative path -is taken to be relative to the web application directory). +```xml +<?xml version="1.0" encoding="UTF-8"?> +<digilib-config> + <parameter name="basedir-list" value="/usr/local/images" /> +</digilib-config> +``` -You need only one directory if you don't want to provide pre-scaled low resolution -versions of your images. If you have pre-scaled images the directory with the -high-resolution images must be the first entry in the list. +A more extensive example is included in the sources as +[digilib-config.xml.template](https://github.com/robcast/digilib/blob/master/webapp/src/main/webapp/WEB-INF/digilib-config.xml.template). + + +## Available parameters -Documentation on the directory layout and on using pre-scaled images is -[here](image-directories.html). +The documented parameter values below are the defaults. + +If relative paths are provided as file locations, these will be resolved with +the web application's directory as base. -A minimal configuration looks like this: +You can inspect a summary of your running digilib configuration at the URL +`<base_url>/server/dlConfig.jsp`. + +### Image locations + +```xml +<parameter name="basedir-list" value="sample-images" /> +``` - <!-- Digilib servlet config file --> - <digilib-config> - <!-- List of directories where images are searched. - The authoritative directory with the high-resolution images - is first in list. --> - <parameter name="basedir-list" value="/docuserver/images" /> - </digilib-config> - -A more customized configuration may look like the following -(for another commented example see -[digilib-config.xml.template](https://sourceforge.net/p/digilib/code/ci/default/tree/webapp/src/main/webapp/WEB-INF/digilib-config.xml.template), -for a full list of -configuration options and their default values use the source: -[DigilibConfiguration](https://sourceforge.net/p/digilib/code/ci/default/tree/common/src/main/java/digilib/conf/DigilibConfiguration.java), -[DigilibServletConfiguration](https://sourceforge.net/p/digilib/code/ci/default/tree/servlet/src/main/java/digilib/conf/DigilibServletConfiguration.java), -[DigilibServlet3Configuration](https://sourceforge.net/p/digilib/code/ci/default/tree/servlet3/src/main/java/digilib/conf/DigilibServlet3Configuration.java) -): +A list of directories where images are searched. See +[this document](image-directories.html) for details. + +```xml +<parameter name="denied-image" value="img/digilib-denied.png" /> +``` + +This image is sent to indicate an authorization failure. + +```xml +<parameter name="error-image" value="img/digilib-error.png" /> +``` + +This image is sent to indicate a general failure. - <!-- Digilib servlet config file --> - <digilib-config> - <!-- Image to be sent to indicate general failure. --> - <parameter name="error-image" value="/docuserver/images/icons/broken.gif" /> - - <!-- Image to be sent to indicate authorization failure. --> - <parameter name="denied-image" value="/docuserver/images/icons/alert.red.gif" /> - - <!-- Image to be sent to indicate file-not-found. --> - <parameter name="notfound-image" value="/docuserver/images/icons/notfound.gif" /> - - <!-- List of directories where images are searched. - The authoritative directory with the high-resolution images - is first in list. --> - <parameter name="basedir-list" value="/docuserver/images:/docuserver/scaled/small" /> - - <!-- default interpolation quality (0=worst) --> - <parameter name="default-quality" value="2"/> - - <!-- is sending whole image files with mo=file allowed? --> - <parameter name="sendfile-allowed" value="true" /> - - <!-- the a maximum size of any sent image. (0 means no limit) --> - <parameter name="max-image-size" value="0" /> - - <!-- number of working threads --> - <parameter name="worker-threads" value="2" /> - - <!-- number of waiting requests in queue --> - <parameter name="max-waiting-threads" value="20" /> - - <!-- Restrict access to authorized users --> - <parameter name="use-authorization" value="false"/> - - <!-- use mapping of "virtual directories" to real directories on the server --> - <parameter name="use-mapping" value="true"/> - - <!-- location of XML name mapping file --> - <parameter name="mapping-file" value="digilib-map.xml"/> - - <!-- location of logger config file --> - <parameter name="log-config-file" value="log4j-config.xml"/> - </digilib-config> +```xml +<parameter name="notfound-image" value="img/digilib-notfound.png" /> +``` + +This image to sent to indicate that the requested image does not exist or could not be read. + +```xml +<parameter name="use-mapping" value="false" /> +``` + +Enables the mapping of 'virtual directories' to actual directories in the +filesystem using a mapping file. + +```xml +<parameter name="mapping-file" value="digilib-map.xml" /> +``` + +The location of the mapping file. Refer to +[digilib-map.xml.template](https://github.com/robcast/digilib/blob/master/webapp/src/main/webapp/WEB-INF/digilib-map.xml.template) +for an example. + +The file contains `mapping` elements with a `link` attribute containing a 'virtual directory' name that is mapped to the +directory given in the `dir` attribute. + + +### Image processing options + +```xml +<parameter name="default-quality" value="2" /> +``` -You can supply your own icons for the "error" and "access denied" -messages by the servlet. Standard images will be used if these -parameters are not defined. +The default interpolation quality. + +* `0`: do not use interpolation (worst), +* `1`: use linear interpolation, +* `2`: use bilinear interpolation and blur-before-scale (best). + +```xml +<parameter name="max-image-size" value="0" /> +``` + +The maximum size of delivered images as pixel area, `40000` means up to 200x200 or 100x400, `0` means no limit. -If you need authorization set `use-authorization` to true and read the +```xml +<parameter name="sendfile-allowed" value="true" /> +``` + +Defines whether requests with `mo=file` or `mo=rawfile` as parameter are allowed to download files (see +[Scaler API](scaler-api.html)). + +```xml +<parameter name="subsample-minimum" value="2.0" /> +``` + +Degree of subsampling on image load. This is the minimum factor that is scaled by interpolation and not by +subsampling, i.e. by skipping pixels. + + +### Authentication and authorization + +Details are provided in the [documentation on authentication and authorization](auth.html). -You can see a summary of your running digilib configuration at the URL -[http://localhost:8080/digitallibrary/server/dlConfig.jsp](http://localhost:8080/digitallibrary/server/dlConfig.jsp) +```xml +<parameter name="auth-file" value="digilib-auth.xml" /> +``` + +Configuration file for authentication and authorization. The format and content of the configuration file +is determined by the chosen authentication and authorization classes. + +```xml +<parameter name="authn-token-cookie" value="id_token" /> +``` + +The name of the cookie that holds the authentication token for `digilib.auth.OpenIdAuthnOps`. + +```xml +<parameter name="authnops-class" value="digilib.auth.IpAuthnOps" /> +``` + +The class to handle authentication. + +```xml +<parameter name="authzops-class" value="digilib.auth.PathAuthzOps" /> +``` + +The class to handle authorization. + +```xml +<parameter name="use-authorization" value="false" /> +``` + +Enable or disable all authorization. If `use-authorization` is `true` it also needs to be configured +using `authnops-class` and `authzops-class` and the `auth-file`. + + +### IIIF API options + +The options configure the IIIF interface. For more information see the [digilib IIIF documentation](iiif-api) + +```xml +<parameter name="iiif-api-version" value="2.1" /> +``` + +The IIIF API version for the generated `info.json` information response. + +```xml +<parameter name="iiif-info-cors" value="true" /> +``` + +Enables the `Cross-Origin Resource Sharing` header in IIIF info requests. + +```xml +<parameter name="iiif-image-cors" value="true" /> +``` + +Enables the `Cross-Origin Resource Sharing` header in IIIF image requests. + +```xml +<parameter name="iiif-prefix" value="IIIF" /> +``` + +The prefix (after `Scaler`) that leads to the IIIF API. + +```xml +<parameter name="iiif-slash-replacement" value="!" /> +``` + +The character that replaces a slash in the identifier of IIIF requests. + + +### Threading options + +```xml +<parameter name="max-waiting-threads" value="20" /> +``` - \ No newline at end of file +The maximum number of requests waiting in the queue before sending "service unavailable". + +```xml +<parameter name="worker-threads" value="2" /> +``` + +The maximum number of concurrently working threads. + +```xml +<parameter name="worker-timeout" value="60000" /> +``` + +Timeout for worker threads in milliseconds. + + +### Assorted options + +```xml +<parameter name="default-errmsg-type" value="image" /> +``` + +Defines how errors are presented to the user. Allowed values are `code`, `image` and +`text`. + +* `image` sends an error-image as error code (see `denied-image`, `error-image`, `notfound-image` parameters). +* `code` sends an HTTP error code, which may result in a broken image display in the browser. +* `text` sends a plain-text error message, which may result in a broken image display in the browser. + +```xml +<parameter name="img-diskcache-allowed" value="false" /> +``` + +Enables the use of a disk cache for the image toolkit. Using the disk cache may leak file handles +and lead to resource issues if digilib runs for a long time. + +```xml +<parameter name="log-config-file" value="log4j-config.xml" /> +``` + +Location of the logging configuration file. The current logger is +[Log4J 1.2](https://logging.apache.org/log4j/1.2/manual.html). + + +### Unknown category + +**TODO** move items to appropriate sections + +```xml +<parameter name="dirmeta-class" value="digilib.meta.IndexMetaDirMeta" /> +``` + +Class for **TODO**. + +```xml +<parameter name="docudirectory-class" value="digilib.io.BaseDirDocuDirectory" /> +``` + +Class for **TODO**. + +```xml +<parameter name="docuimage-class" value="digilib.image.ImageLoaderDocuImage" /> +``` + +Class for the `DocuImage` instance, **TODO** elaborate intended use + +```xml +<parameter name="docuimage-hacks" value="" /> +``` + +**TODO** elaborate + +```xml +<parameter name="filemeta-class" value="digilib.meta.IndexMetaFileMeta" /> +``` +Class for **TODO**.
--- a/doc/src/site/markdown/index.md Mon Jun 12 16:08:27 2017 +0200 +++ b/doc/src/site/markdown/index.md Tue Nov 21 15:18:31 2017 +0100 @@ -26,10 +26,11 @@ ## Where can I get digilib? `digilib` source code, binaries and documentation can be found on the -[digilib project pages](https://sourceforge.net/projects/digilib/) -on [SourceForge](https://sourceforge.net/): +[digilib project pages](https://github.com/robcast/digilib) +on [GitHub](https://github.com) +or [SourceForge](https://sourceforge.net/projects/digilib/): -* [Source code](https://sourceforge.net/p/digilib/code/ci/default/tree/) +* [Source code](https://github.com/robcast/digilib) * Daily built [WAR files](https://it-dev.mpiwg-berlin.mpg.de/downloads/digilib/daily-build/) * Daily built [Javadoc](https://it-dev.mpiwg-berlin.mpg.de/downloads/digilib/daily-build/javadoc/) * [Maven repository](http://it-dev.mpiwg-berlin.mpg.de/maven-repo/)
--- a/doc/src/site/markdown/install-digilib.md Mon Jun 12 16:08:27 2017 +0200 +++ b/doc/src/site/markdown/install-digilib.md Tue Nov 21 15:18:31 2017 +0100 @@ -2,73 +2,102 @@ To run digilib you need: -* [Java](http://www.java.com/) (1.6 or higher) +* [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (7 or higher) * a Servlet Container like [Tomcat](http://tomcat.apache.org/) (version 7 or -higher) or [Jetty](http://www.eclipse.org/jetty/) (version 8 or higher) +later) or [Jetty](http://www.eclipse.org/jetty/) (version 8 or later) * the digilib web application as a WAR file or application directory -## Run the Servlet Container +## Start the Servlet Container Install and run the Servlet Container of your choice: [Tomcat](http://tomcat.apache.org/tomcat-7.0-doc/setup.html) or [Jetty](http://wiki.eclipse.org/Jetty/Howto/Run_Jetty). -When it runs you should be able to access the start page on +When the Servlet Container runs you should be able to access the start page on <http://localhost:8080/> +## Deploy via WAR file or web application directory? + +A web application can be deployed either as a WAR file or a web application directory (aka "exploded web application"). + +The advantage of the WAR file is that it is easy to handle because it is just one file. + +The disadvantage of the WAR file is that it is not easy to change the [digilib configuration](digilib-config.html) +file or any of the HTML or Javascript files because they are hidden in the WAR file. + +It is possible to unpack a WAR file into a web application directory to be able to change its contents (see below). + +## Where to get a WAR file or web application directory? + +The preferred way is to [build your own](build-maven.html) WAR file or web application directory using the digilib sources. +In this way you can change the configuration files in the source directory and create a new WAR file +or web application directory any time you need. +Also you get the chance to always use the latest digilib version by updating the source code. + +You can also download a digilib WAR file with a default configuration from the +[SourceForge download page](https://sourceforge.net/projects/digilib/files/) +or the latest digilib build from the +[daily build page](https://it-dev.mpiwg-berlin.mpg.de/downloads/digilib/daily-build/). +The default configuration will only show a set of sample images. If you want to show your own images +you will need to change the [digilib configuration](digilib-config.html) to point to your image directories. + + ## Install a digilib WAR file -1. Download a digilib WAR file of a recent digilib release from the -SourceForge [Download page](https://sourceforge.net/projects/digilib/files/) -or the latest digilib build from the -[daily build page](https://it-dev.mpiwg-berlin.mpg.de/downloads/digilib/daily-build/). +1. Get a digilib WAR file. 2. Rename the WAR file to `digilib.war`. -3. Deploy the WAR file, i.e. drop it into the `webapps` directory of your +3. Deploy the WAR file by copying it into the `webapps` directory of your Servlet Container. 4. Restart your Servlet Container (this may not be necessary). 5. Access your digilib instance at <http://localhost:8080/digilib/digilib.html>. You will now be able to see the sample images provided with the digilib -installation. +installation in the default configuration yor your own images +if you have updated the [configuration](digilib-config.html). -If you want to use digilib to show your own images you have to change the -configuration file [digilib-config.xml](digilib-config.html) **inside** the -web application. This is hard to do with a WAR file so its better to -deploy digilib as a web application directory. +In digilib you can view images by providing the directory and file +name as the `fn` parameter to `digilib.html`, e.g. if your file is called +`ruler.jpg` and it is in the base directory you can now access the URL + +<http://localhost:8080/digilib/digilib.html?fn=ruler> + +Read more about the layout of image files and directories +[here](image-directories.html). + ## Install digilib as a web application directory -Unpack the WAR file into a directory called `digilib` using +1. Get a digilib web application directory. +2. Rename the WAR file to `digilib.war`. +3. Deploy the WAR file by copying it into the `webapps` directory of your +Servlet Container. +4. Restart your Servlet Container (this may not be necessary). +5. Access your digilib instance at <http://localhost:8080/digilib/digilib.html> + +You will now be able to see the sample images provided with the digilib +installation in the default configuration yor your own images +if you have updated the [configuration](digilib-config.html). + +In digilib you can view images by providing the directory and file +name as the `fn` parameter to `digilib.html`, e.g. if your file is called +`ruler.jpg` and it is in the base directory you can now access the URL + +<http://localhost:8080/digilib/digilib.html?fn=ruler> + +Read more about the layout of image files and directories +[here](image-directories.html). + + +## Unpack a WAR file into a web application directory + +You can unpack the WAR file into a directory called `digilib` using an unzip tool or the `jar -xf` Java command. Alternatively you can look into the `webapps` directory of your Servlet Container (when its not running) to see if it created an unpacked web -application directory called `digilib`. - -Alternatively you can build your own version of digilib as documented -[here](build-maven.html). - -Then: +application directory called `digilib`. Then: 1. Make sure that your Servlet Container is not running and remove any `digilib.war` files from the `webapps` directory. 2. Copy your `digilib` directory into the `webapps` directory of the Servlet Container. -3. Edit the `digilib-config.xml` file in the `WEB-INF` subdirectory of the -`digilib` directory and adjust the `basedir-list` parameter to point to -the directory with your image files [according to the -documentation](digilib-config.html). If there is no file `digilib-config.xml` -you can either create a new file or rename the sample file -`digilib-config.xml.template` to `digilib-config.xml` and edit it. -4. Start your Servlet Container. -5. Access your digilib instance at <http://localhost:8080/digilib/digilib.html> - -You can now view your own images in digilib by providing the directory and file -name as the `fn` parameter to `digilib.html`, e.g. if your file is called -`flower.jpg` and it is in a subdirectory of the base directory called -`digilib-test` you can now access the URL - -<http://localhost:8080/digilib/digilib.html?fn=digilib-test/flower> - -Read more about the layout of image files and directories -[here](image-directories.html).
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/src/site/markdown/server-setup.md Tue Nov 21 15:18:31 2017 +0100 @@ -0,0 +1,40 @@ +# Server setups for digilib + +There are a variety of ways to deploy digilib on different server configurations for production sites. + +Here are some examples. + +## nginx as proxy + +This is an example configuration for `nginx` as a proxy for a single instance +of digilib (listening on port `8080`) that handles transport encryption and +restricts access to sensitive data to the gateway of a local network +(`1.2.3.4`). + +```nginx +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name digilib.example.org; + + # this certificate chain shall *not* include the root certificate: + ssl_certificate /etc/ssl/certs/digilib.example.org.pem; + ssl_certificate_key /etc/ssl/private/digilib.example.org.key; + + include /etc/nginx/proxy_params; + + location ~* .*/(dlConfig|dlRequest).jsp$ { + allow 1.2.3.4; + deny all; + proxy_pass http://localhost:8080; + } + + location / { + proxy_pass http://localhost:8080; + } +} +``` + +## Resources + +- the [nginx documentation](nginx.org/en/docs/)
--- a/doc/src/site/site.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/doc/src/site/site.xml Tue Nov 21 15:18:31 2017 +0100 @@ -10,15 +10,16 @@ </skin> <bannerLeft> <name>digilib - a versatile image viewing environment for the internet</name> - <href>http://digilib.sourceforge.net/</href> + <href>https://robcast.github.io/digilib/</href> </bannerLeft> <bannerRight> <src>images/digilib-logo-small.png</src> - <href>http://digilib.sourceforge.net/</href> + <href>https://robcast.github.io/digilib/</href> </bannerRight> <poweredBy> - <logo name="Built by Maven" href="http://maven.apache.org/" img="http://maven.apache.org/images/logos/maven-feather.png"/> - <logo name="Hosted by SourceForge" href="http://www.sourceforge.net/" img="http://upload.wikimedia.org/wikipedia/commons/0/0b/Sourceforge_logo.png"/> + <logo name="Built by Maven" href="http://maven.apache.org/" img="https://maven.apache.org/images/logos/maven-feather.png"/> + <logo name="Hosted by GitHub" href="https://github.com/" img="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Logo.png" width="200px"/> + <logo name="Hosted by SourceForge" href="http://www.sourceforge.net/" img="https://upload.wikimedia.org/wikipedia/commons/0/0b/Sourceforge_logo.png"/> </poweredBy> <body> <menu name="Overview"> @@ -28,8 +29,9 @@ <item name="Ancient history" href="history.html"/> </menu> <menu name="Installation"> + <item name="Building digilib" href="build-maven.html"/> <item name="Installing digilib" href="install-digilib.html"/> - <item name="Building digilib" href="build-maven.html"/> + <item name="Server setups" href="server-setups.html"/> </menu> <menu name="Configuration"> <item name="Configuring digilib" href="digilib-config.html"/>
--- a/iiif-presentation/pom.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/iiif-presentation/pom.xml Tue Nov 21 15:18:31 2017 +0100 @@ -11,7 +11,7 @@ <artifactId>digilib-iiif-presentation</artifactId> <name>digilib-iiif-presentation</name> <description>The Digital Image Library - IIIF presentation API manifest serving servlet</description> - <url>http://digilib.sourceforge.net</url> + <url>https://github.com/robcast/digilib</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>
--- a/iiif-presentation/src/main/java/digilib/conf/ManifestServletConfiguration.java Mon Jun 12 16:08:27 2017 +0200 +++ b/iiif-presentation/src/main/java/digilib/conf/ManifestServletConfiguration.java Tue Nov 21 15:18:31 2017 +0100 @@ -59,8 +59,14 @@ public ManifestServletConfiguration() { super(); + // base URL used in constructing IIIF manifests including servlet name and iiif-prefix (optional) + newParameter("iiif-manifest-base-url", null, null, 'f'); + // base URL used in constructing IIIF manifests including servlet name and iiif-prefix (optional) + newParameter("iiif-image-base-url", null, null, 'f'); + // web-application base URL used in constructing API paths (optional) + newParameter("webapp-base-url", null, null, 'f'); // Scaler servlet name used in constructing IIIF image API paths - newParameter("scaler-servlet-path", "Scaler", null, 'f'); + newParameter("scaler-servlet-name", "Scaler", null, 'f'); } /*
--- a/iiif-presentation/src/main/java/digilib/servlet/Manifester.java Mon Jun 12 16:08:27 2017 +0200 +++ b/iiif-presentation/src/main/java/digilib/servlet/Manifester.java Tue Nov 21 15:18:31 2017 +0100 @@ -125,7 +125,7 @@ // DocuDirCache instance dirCache = (DocuDirCache) dlConfig.getValue(DigilibServletConfiguration.DIR_CACHE_KEY); // Scaler path - scalerServletPath = dlConfig.getAsString("scaler-servlet-path"); + scalerServletPath = dlConfig.getAsString("scaler-servlet-name"); // IIIF path separator iiifPathSep = dlConfig.getAsString("iiif-slash-replacement"); // CORS for info requests @@ -256,17 +256,27 @@ } /* - * get manifest base URL + * configure base URLs for manifest */ - String url = request.getRequestURL().toString(); - // get base URL for Servlets - int srvPathLen = request.getServletPath().length() + request.getPathInfo().length(); - String servletBaseUrl = url.substring(0, url.length() - srvPathLen); - // manifest base URL - String baseurl = servletBaseUrl + request.getServletPath() + "/" + dlConfig.getAsString("iiif-prefix") + "/" + identifier; - - params.manifestUrl = baseurl; - params.imgApiUrl = servletBaseUrl +"/" + this.scalerServletPath + "/" + dlConfig.getAsString("iiif-prefix"); + params.imgApiUrl = dlConfig.getAsString("iiif-image-base-url"); + String manifestBaseUrl = dlConfig.getAsString("iiif-manifest-base-url"); + if ("".equals(params.imgApiUrl) || "".equals(manifestBaseUrl)) { + // try to figure out base URLs + String servletBaseUrl = dlConfig.getAsString("webapp-base-url"); + if ("".equals(servletBaseUrl)) { + String url = request.getRequestURL().toString(); + // get base URL for web application by last occurrence of Servlet path + int srvPathLen = url.lastIndexOf(request.getServletPath()); + servletBaseUrl = url.substring(0, srvPathLen); + } + // manifest base URL + manifestBaseUrl = servletBaseUrl + request.getServletPath() + "/" + dlConfig.getAsString("iiif-prefix"); + // Image API base URL + params.imgApiUrl = servletBaseUrl + "/" + this.scalerServletPath + "/" + + dlConfig.getAsString("iiif-prefix"); + } + // full manifest URL with identifier + params.manifestUrl = manifestBaseUrl + "/" + identifier; params.identifier = identifier; params.docuDir = dlDir; @@ -366,6 +376,7 @@ ImageFileSet imgFs = (ImageFileSet) imgFile; ImageInput img = imgFs.getBiggest(); ImageSize imgSize = img.getSize(); + if (imgSize == null) continue; /* * canvas */
--- a/pdf/pom.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/pdf/pom.xml Tue Nov 21 15:18:31 2017 +0100 @@ -9,7 +9,7 @@ <artifactId>digilib-pdf</artifactId> <name>digilib-pdf</name> <description>The Digital Image Library - PDF generation servlet</description> - <url>http://digilib.sourceforge.net</url> + <url>https://github.com/robcast/digilib</url> <repositories> <!-- <repository> <id>itextpdf.com</id>
--- a/pom.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/pom.xml Tue Nov 21 15:18:31 2017 +0100 @@ -13,12 +13,12 @@ <name>digilib</name> <description>The Digital Image Library</description> - <url>http://digilib.sourceforge.net</url> + <url>https://robcast.github.io/digilib/</url> <inceptionYear>2001</inceptionYear> <organization> <name>digilib Community</name> - <url>http://digilib.sourceforge.net</url> + <url>https://robcast.github.io/digilib/</url> </organization> <developers> @@ -76,13 +76,13 @@ </license> </licenses> <scm> - <connection>scm:hg:http://hg.code.sf.net/p/digilib/code</connection> - <developerConnection>scm:hg:https://hg.code.sf.net/p/digilib/code</developerConnection> - <url>https://sourceforge.net/p/digilib/code/ci/default/tree</url> + <connection>scm:git:https://github.com/robcast/digilib.git</connection> + <developerConnection>scm:git:ssh://git@github.com/robcast/digilib.git</developerConnection> + <url>https://github.com/robcast/digilib</url> </scm> <issueManagement> - <system>Trac</system> - <url>https://it-dev.mpiwg-berlin.mpg.de/tracs/digilib</url> + <system>Github Issues</system> + <url>https://github.com/robcast/digilib/issues</url> </issueManagement> <mailingLists> <mailingList>
--- a/servlet/pom.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/servlet/pom.xml Tue Nov 21 15:18:31 2017 +0100 @@ -9,7 +9,7 @@ </parent> <artifactId>digilib-servlet</artifactId> <name>digilib-servlet</name> - <url>http://digilib.sourceforge.net</url> + <url>https://github.com/robcast/digilib</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>
--- a/servlet/src/main/java/digilib/servlet/ServletOps.java Mon Jun 12 16:08:27 2017 +0200 +++ b/servlet/src/main/java/digilib/servlet/ServletOps.java Tue Nov 21 15:18:31 2017 +0100 @@ -267,13 +267,14 @@ public static void sendFile(File f, String mt, String name, HttpServletResponse response, Logger logger) throws ImageOpException, IOException { logger.debug("sendRawFile(" + mt + ", " + f + ")"); - if (response == null) { - logger.error("No response!"); - return; - } - /* - * set content-type - */ + if (response == null) { + logger.error("No response!"); + return; + } + + /* + * set content-type + */ if (mt == null) { // auto-detect mime-type mt = FileOps.mimeForFile(f); @@ -282,34 +283,44 @@ } } response.setContentType(mt); + + /* + * set content-disposition with filename. + * uses image filename. + */ + if (name == null) { + // no download name -- use filename + name = f.getName(); + } if (mt.startsWith("application")) { - if (name == null) { - // no download name -- use filename - name = f.getName(); - } - response.addHeader("Content-Disposition", "attachment; filename=\""+name+"\""); + response.addHeader("Content-Disposition", "attachment; filename=\"" + name + "\""); + } else { + response.addHeader("Content-Disposition", "inline; filename=\"" + name + "\""); } /* - * set CORS header ACAO "*" for image response - */ - if (corsForImageRequests) { - // TODO: would be nice to check request for Origin header - response.setHeader("Access-Control-Allow-Origin", "*"); - } + * set CORS header ACAO "*" for image response + */ + if (corsForImageRequests) { + // TODO: would be nice to check request for Origin header + response.setHeader("Access-Control-Allow-Origin", "*"); + } /* * open file */ - FileInputStream inFile = null; + FileInputStream inFile = null; try { inFile = new FileInputStream(f); OutputStream outStream = response.getOutputStream(); - // TODO: should we set content length? + // TODO: should we set content length? // see http://www.prozesse-und-systeme.de/servletFlush.html - response.setContentLength( (int) f.length()); + response.setContentLength((int) f.length()); byte dataBuffer[] = new byte[4096]; int len; + /* + * write file to stream + */ while ((len = inFile.read(dataBuffer)) != -1) { // copy out file outStream.write(dataBuffer, 0, len); @@ -352,17 +363,16 @@ * @throws ImageOpException * @throws ServletException Exception on sending data. */ - public static void sendImage(DocuImage img, String mimeType, HttpServletResponse response, Logger logger) - throws ImageOpException, ServletException { - if (response == null) { - logger.error("No response!"); - return; - } - logger.debug("sending to response. committed=" + response.isCommitted()); + public static void sendImage(DocuImage img, String mimeType, HttpServletResponse response, Logger logger) + throws ImageOpException, ServletException { + if (response == null) { + logger.error("No response!"); + return; + } try { /* - * determine the content-type: if mime type is set use that - * otherwise if source is JPG then dest will be JPG else it's PNG + * determine the content-type: if mime type is set use that otherwise if source + * is JPG then dest will be JPG else it's PNG */ if (mimeType == null) { mimeType = img.getMimetype(); @@ -372,47 +382,44 @@ mimeType = "image/jpeg"; } } - if ((mimeType.equals("image/jpeg") || mimeType.equals("image/jp2") || - mimeType.equals("image/fpx"))) { + if ((mimeType.equals("image/jpeg") || mimeType.equals("image/jp2") || mimeType.equals("image/fpx"))) { mimeType = "image/jpeg"; } else { mimeType = "image/png"; } // set the content type response.setContentType(mimeType); - // check content type - String respType = response.getContentType(); - if (! mimeType.equals(respType)) { - // this shouldn't happen - logger.error("Crap! ServletResponse lost content type! ["+respType+"] Aborting!"); - // TODO: would this even help? - response.getOutputStream().close(); - return; + + /* + * set content-disposition with filename. + * uses filename provided in DocuImage. + */ + String name = (String) img.getHint("download-filename"); + if (name != null) { + response.addHeader("Content-Disposition", "inline; filename=\"" + name + "\""); } - /* - * set CORS header ACAO "*" for image response - */ - if (corsForImageRequests) { - // TODO: would be nice to check request for Origin header - response.setHeader("Access-Control-Allow-Origin", "*"); - } + * set CORS header ACAO "*" for image response + */ + if (corsForImageRequests) { + // TODO: would be nice to check request for Origin header + response.setHeader("Access-Control-Allow-Origin", "*"); + } /* * write the image */ OutputStream outstream = response.getOutputStream(); img.writeImage(mimeType, outstream); - + } catch (IOException e) { throw new ServletException("Error sending image:", e); - } finally { - img.dispose(); - } + } finally { + img.dispose(); + } } - /** * Returns IIIF compatible image information as application/json response. * @@ -510,11 +517,11 @@ + "\"mirroring\", \"rotationArbitrary\", \"sizeAboveFull\", \"regionSquare\"" + "]"); writer.println(" }]"); - // add sizes of prescaled images + // add size of original and prescaled images int numImgs = imageSet.size(); - if (numImgs > 1) { + if (numImgs > 0) { writer.println(", \"sizes\" : ["); - for (int i = numImgs - 1; i > 0; --i) { + for (int i = numImgs - 1; i >= 0; --i) { ImageInput ii = imageSet.get(i); ImageSize is = ii.getSize(); writer.println(" {\"width\" : "+is.getWidth()+", \"height\" : "+is.getHeight()+"}"
--- a/text/pom.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/text/pom.xml Tue Nov 21 15:18:31 2017 +0100 @@ -17,7 +17,7 @@ </dependency> </dependencies> <description>The Digital Image Library - text (plain or XML) serving servlet</description> - <url>http://digilib.sourceforge.net</url> + <url>https://github.com/robcast/digilib</url> <profiles> <profile> <id>servlet2</id>
--- a/webapp/pom.xml Mon Jun 12 16:08:27 2017 +0200 +++ b/webapp/pom.xml Tue Nov 21 15:18:31 2017 +0100 @@ -11,7 +11,7 @@ <artifactId>digilib-webapp</artifactId> <name>digilib-webapp</name> <description>The Digital Image Library - web application server and HTML and JS clients.</description> - <url>http://digilib.sourceforge.net</url> + <url>https://github.com/robcast/digilib</url> <packaging>war</packaging> <properties> @@ -192,6 +192,17 @@ </execution> --> </executions> </plugin> + <plugin> + <!-- Jetty plugin for "mvn jetty:run" --> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-maven-plugin</artifactId> + <version>9.2.22.v20170606</version> + <configuration> + <webApp> + <contextPath>/digilib</contextPath> + </webApp> + </configuration> + </plugin> </plugins> </build> <profiles> @@ -386,13 +397,13 @@ <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> - <version>9.2.13.v20150730</version> + <version>9.2.22.v20170606</version> <scope>test</scope> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-http</artifactId> - <version>9.2.13.v20150730</version> + <version>9.2.22.v20170606</version> <scope>test</scope> </dependency> <dependency>
--- a/webapp/src/main/webapp/jquery/digilib-dbg.html Mon Jun 12 16:08:27 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <meta name="viewport" content="initial-scale=1.0"/> - <title>Digilib jQuery: fullscreen</title> - - <style type="text/css"> - body { - background: silver; - } - </style> - - <script type="text/javascript" src="jquery.js"></script> - <script type="text/javascript" src="jquery.cookie.js"></script> - <script type="text/javascript" src="jquery.digilib.js"></script> - <script type="text/javascript" src="jquery.digilib.geometry.js"></script> - <script type="text/javascript" src="jquery.digilib.arrows.js"></script> - <script type="text/javascript" src="jquery.range.js"></script> - <link rel="stylesheet" type="text/css" href="jquery.range.css" /> - <script type="text/javascript" src="jquery.digilib.buttons.js"></script> - <script type="text/javascript" src="jquery.digilib.dialogs.js"></script> - <script type="text/javascript" src="jquery.digilib.sliders.js"></script> - <script type="text/javascript" src="jquery.digilib.birdseye.js"></script> - <script type="text/javascript" src="jquery.digilib.marks.js"></script> - <script type="text/javascript" src="jquery.digilib.regions.js"></script> - <link rel="stylesheet" type="text/css" href="jquery.digilib.css" /> - <link rel="stylesheet" type="text/css" href="jquery.digilib.buttons-full-32-sprite.css" /> - - <script type="text/javascript"> - $(document).ready(function(){ - var opts = { - interactionMode : 'fullscreen', - showRegionNumbers : true - }; - var $div = $('div#digilib'); - $div.digilib(opts); - }); - - </script> - </head> - - <body> - <div id="digilib"> - <p>digilib doesn't work! Please switch on Javascript or notify the server administrator!</p> - <img src="http://digilib.sourceforge.net/images/digilib-logo-big.png" /> - </div> - </body> -</html> -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/jquery/digilib-dev.html Tue Nov 21 15:18:31 2017 +0100 @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <meta name="viewport" content="initial-scale=1.0"/> + <title>Digilib jQuery: fullscreen</title> + + <style type="text/css"> + body { + background: silver; + } + </style> + + <script type="text/javascript" src="jquery.js"></script> + <script type="text/javascript" src="jquery.cookie.js"></script> + <script type="text/javascript" src="jquery.digilib.js"></script> + <script type="text/javascript" src="jquery.digilib.geometry.js"></script> + <script type="text/javascript" src="jquery.digilib.arrows.js"></script> + <script type="text/javascript" src="jquery.range.js"></script> + <link rel="stylesheet" type="text/css" href="jquery.range.css" /> + <script type="text/javascript" src="jquery.digilib.buttons.js"></script> + <script type="text/javascript" src="jquery.digilib.dialogs.js"></script> + <script type="text/javascript" src="jquery.digilib.sliders.js"></script> + <script type="text/javascript" src="jquery.digilib.birdseye.js"></script> + <script type="text/javascript" src="jquery.digilib.marks.js"></script> + <script type="text/javascript" src="jquery.digilib.regions.js"></script> + <link rel="stylesheet" type="text/css" href="jquery.digilib.css" /> + <link rel="stylesheet" type="text/css" href="jquery.digilib.buttons-full-32-sprite.css" /> + + <script type="text/javascript"> + $(document).ready(function(){ + var opts = { + interactionMode : 'fullscreen', + showRegionNumbers : true + }; + var $div = $('div#digilib'); + $div.digilib(opts); + }); + + </script> + </head> + + <body> + <div id="digilib"> + <p>digilib doesn't work! Please switch on Javascript or notify the server administrator!</p> + <img src="http://digilib.sourceforge.net/images/digilib-logo-big.png" /> + </div> + </body> +</html> +