Interface JavaContext


public interface JavaContext

Contains information about the current request for consumption within the JavaDelegate.

In order to minimize coupling against user code, no internal application API is exposed.

Since:
5.0
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getClientIPAddress()  
    java.util.Map<java.lang.String,​java.lang.String> getCookies()  
    java.util.Map<java.lang.String,​java.lang.Integer> getFullSize()
    N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.
    java.lang.String getIdentifier()  
    java.lang.String getLocalURI()  
    java.util.Map<java.lang.String,​java.lang.Object> getMetadata()
    Map with the following structure:
    java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getOperations()
    N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.
    java.lang.String getOutputFormat()
    N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.
    java.lang.Integer getPageNumber()  
    java.util.Map<java.lang.String,​java.lang.String> getRequestHeaders()  
    java.lang.String getRequestURI()  
    java.util.Map<java.lang.String,​java.lang.Integer> getResultingSize()
    N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.
    int[] getScaleConstraint()  
  • Method Details

    • getClientIPAddress

      java.lang.String getClientIPAddress()
      Returns:
      Client IP address.
    • getCookies

      java.util.Map<java.lang.String,​java.lang.String> getCookies()
      Returns:
      Map of cookie name-value pairs, or an empty map if none exist.
    • getFullSize

      java.util.Map<java.lang.String,​java.lang.Integer> getFullSize()
      N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.
      Returns:
      Map with width and height keys corresponding to the pixel dimensions of the source image.
    • getIdentifier

      java.lang.String getIdentifier()
      Returns:
      Image identifier.
    • getLocalURI

      java.lang.String getLocalURI()
      Returns:
      URI seen by the application, which may be different from getRequestURI() when operating behind a reverse proxy server.
    • getMetadata

      java.util.Map<java.lang.String,​java.lang.Object> getMetadata()

      Map with the following structure:

      {
           "exif": {
               "tagSet": "Baseline TIFF",
               "fields": {
                   "Field1Name": value,
                   "Field2Name": value,
                   "EXIFIFD": {
                       "tagSet": "EXIF",
                       "fields": {
                           "Field1Name": value,
                           "Field2Name": value
                       }
                   }
               }
           },
           "iptc": [
               "Field1Name": value,
               "Field2Name": value
           ],
           "xmp_string": "<rdf:RDF>...</rdf:RDF>",
           "xmp_model": https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/Model.html
           "native": {
               # structure varies
           }
       }
      • The exif key refers to embedded EXIF data. This also includes IFD0 metadata from source TIFFs, whether or not an EXIF IFD is present.
      • The iptc key refers to embedded IPTC IIM data.
      • The xmp_string key refers to raw embedded XMP data, which may or may not contain EXIF and/or IPTC information.
      • The xmp_model key contains a org.apache.jena.rdf.model.Model object pre-loaded with the contents of xmp_string.
      • The native key refers to format-specific metadata.

      Any combination of the above keys may be present or missing depending on what is available in a particular source image.

      N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.

      Returns:
      See above.
    • getOperations

      java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getOperations()
      N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.
      Returns:
      List of operations in order of application. Only operations that are not no-ops are included. Every map contains a class key corresponding to the operation class name, which will be one of the edu.illinois.library.cantaloupe.operation.Operation implementations.
    • getOutputFormat

      java.lang.String getOutputFormat()
      N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.
      Returns:
      Output format media (MIME) type.
    • getPageNumber

      java.lang.Integer getPageNumber()
      Returns:
      Page number requested by the client.
    • getRequestHeaders

      java.util.Map<java.lang.String,​java.lang.String> getRequestHeaders()
      Returns:
      Map of header name-value pairs.
    • getRequestURI

      java.lang.String getRequestURI()
      Returns:
      URI requested by the client.
    • getResultingSize

      java.util.Map<java.lang.String,​java.lang.Integer> getResultingSize()
      N.B.: The return value is only available after the image has been accessed; before then, it is an empty map.
      Returns:
      Map with width and height keys corresponding to the pixel dimensions of the resulting image after all operations have been applied.
    • getScaleConstraint

      int[] getScaleConstraint()
      Returns:
      Two-element array with numerator at position 0 and denominator at position 1.