Package digilib.conf

Class DigilibRequest

  • Direct Known Subclasses:
    DigilibServletRequest

    public class DigilibRequest
    extends ParameterMap
    Class holding the parameters of a digilib user request. The parameters are mostly named like the servlet parameters:
    request.path: url of the page/document.
    fn: url of the page/document.
    pn: page number.
    dw: width of result window in pixels.
    dh: height of result window in pixels.
    wx: left edge of image area (float from 0 to 1).
    wy: top edge of image area (float from 0 to 1).
    ww: width of image area(float from 0 to 1).
    wh: height of image area(float from 0 to 1).
    ws: scale factor.
    mo: special options like 'fit'.
    ...et cetera
    Author:
    casties
    • Field Detail

      • iiifPrefix

        public String iiifPrefix
        IIIF path prefix (taken from config)
      • iiifSlashReplacement

        protected String iiifSlashReplacement
        IIIF slash replacement (taken from config)
      • iiifApiVersion

        public String iiifApiVersion
        IIIF image API version
      • parseIiifImageApi

        public boolean parseIiifImageApi
        parse IIIF path as IIIF image API
      • errorMessage

        public String errorMessage
        error message while configuring
    • Constructor Detail

      • DigilibRequest

        public DigilibRequest()
      • DigilibRequest

        public DigilibRequest​(DigilibConfiguration config)
        Create DigilibRequest with DigilibConfiguration.
        Parameters:
        config - the DigilibConfiguration
      • DigilibRequest

        public DigilibRequest​(DigilibConfiguration config,
                              ParameterMap params)
        Create DigilibRequest with DigilibConfiguration with added ParameterMap.
        Parameters:
        config - the DigilibConfiguration
        params - ParameterMap to add
    • Method Detail

      • initParams

        protected void initParams()
        Define and set up parameters with default values.
        Overrides:
        initParams in class ParameterMap
      • getAsString

        public String getAsString()
        Return the request parameters as a String in the parameter form 'fn=/icons&pn=1'. Empty (undefined) fields are not included.
        Returns:
        String of request parameters in parameter form.
      • getAsString

        public String getAsString​(int type)
        Return the request parameters of a given type type as a String in the parameter form 'fn=/icons&pn=1'. Empty (undefined) fields are not included.
        Parameters:
        type - the type
        Returns:
        String of request parameters in parameter form.
      • setWithParamString

        public void setWithParamString​(String qs,
                                       String sep)
        Set request parameters from query string. Uses the separator string qs to get 'fn=foo' style parameters.
        Parameters:
        qs - query string
        sep - parameter-separator string
      • setWithIiifPath

        public boolean setWithIiifPath​(String path)
        Populate a request from a string with an IIIF image API path. path should be non-URL-decoded and have no leading slash. URI template: {scheme}://{server}{/prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}
        Parameters:
        path - String with IIIF Image API path.
        Returns:
        true of successful
        See Also:
        IIIF Image API
      • setWithIiifImageParams

        public boolean setWithIiifImageParams​(String identifier,
                                              String region,
                                              String size,
                                              String rotation,
                                              String quality,
                                              String format)
        Populate a request from IIIF image API parameters.
        Parameters:
        identifier - the identifier
        region - the region
        size - the size
        rotation - the rotation
        quality - the quality
        format - the format
        Returns:
        true if successful
        See Also:
        IIIF Image API
      • decodeIiifIdentifier

        public String decodeIiifIdentifier​(String identifier)
        Decodes the IIIF identifier part into a digilib path.
        Parameters:
        identifier - the identifier
        Returns:
        the path
        Throws:
        UnsupportedEncodingException - on error
      • encodeIiifIdentifier

        public String encodeIiifIdentifier​(String path)
        Encodes a digilib path into an IIIF identifier part
        Parameters:
        path - the path
        Returns:
        the identifier
        Throws:
        UnsupportedEncodingException - on error
      • hasOption

        public boolean hasOption​(String param,
                                 String opt)
        Deprecated.
        Test if option string opt is set. Checks if the substring opt is contained in the options string param.
        Parameters:
        param - the param
        opt - Option string to be tested.
        Returns:
        if option is set
      • getFilePath

        public String getFilePath()
        The image file path to be accessed. The image file path is assembled from the servlets RequestPath and Parameter fn and normalized.
        Returns:
        the effective filepath.
      • setJobDescription

        public void setJobDescription​(ImageJobDescription ticket)
        Parameters:
        ticket - the ticket to set
      • setDigilibConfig

        public void setDigilibConfig​(DigilibConfiguration config)
        Parameters:
        config - the config to set