digitalutsc / islandora_display

Provides configurations (view displays) to display various media content.
GNU General Public License v3.0
0 stars 0 forks source link

Add ARK ids to IIIF Manifest #4

Open kstapelfeldt opened 2 years ago

kstapelfeldt commented 2 years ago

/admin/structure/views/view/iiif_manifest/edit/rest_export_2

amym-li commented 1 year ago

Overview of how to set up using Ark suffixes:

See Arks with IIIFs (google doc) for more detailed instructions on how to set this up

kstapelfeldt commented 1 year ago

We will use delegate script to support arkid/manifest as a path and use this URL in the interface affordance for accessing the manifest. We will also prototype the solution Amy has discovered and assess the performance hit, and write this up for review by the wider community (hopefully as an article)

amym-li commented 1 year ago

The cantaloupe container in isle-dc will take care of any redirection needed to resolve the Ark URLs as long as it has access to the external network (so no need for a delegate script). By default, the cantaloupe container only has access to the default internal network.

Access can be granted by either:

Before building Edit docker-compose.cantaloupe.yml, under networks, add gateway:

OR

After building Run docker network connect isle-dc_gateway isle-dc_cantaloupe_1

Then, within the manifest, we can use:

https://islandora.traefik.me/cantaloupe/iiif/2/<Ark URL to file (URL encoded)> instead of: https://islandora.traefik.me/cantaloupe/iiif/2/<direct link to file (URL encoded)>

For more information, see Arks with IIIFs


Additional Notes - work done for the delegate script

In isle-dc_cantaloupe_1:/opt/tomcat/conf/cantaloupe.properties, set

delegate_script.pathname = /opt/tomcat/bin/delegates.rb
HttpSource.lookup_strategy = ScriptLookupStrategy

In isle-dc_cantaloupe_1:/opt/tomcat/bin/delegates.rb,

For one level of redirection:

def httpsource_resource_info(options = {})
  response = Net::HTTP.get_response(URI(context['identifier']))
  return { "uri" => response['location'] }
end

For more than one level of redirection:

def httpsource_resource_info(options = {})
  response = Net::HTTP.get_response(URI(context['identifier']))
  until response['location'].nil?
    response = Net::HTTP.get_response(URI(response['location']))
  end
  return { "uri" => response['location'] }
end

Another approach for multilevel redirection: Net::HTTP - Following Redirection