fcrepo-exts / fcrepo-import-export

Apache License 2.0
15 stars 19 forks source link

Write additional fcrepo headers for redirected content #160

Closed mikejritter closed 3 years ago

mikejritter commented 3 years ago

Resolves: https://fedora-repository.atlassian.net/browse/FCREPO-3620

This adds a check to see if a binary is some type of redirected content, and if so writes additional headers from the Fedora repository.

Notes

I opted for adding .fcrepo to the file so we can differentiate between the two header types, wasn't sure the best but at least that gives information about where they came from. Alternatively we could change this so that the non-redirected headers are written as file.external.headers and the redirected headers are file.external.redirect-headers. This might allow for fewer changes when updating the upgrade-utils.

Testing

Add some external content to your Fedora repository in the form of redirected content, e.g.

curl -i -H "Link: <http://localhost/images/image.jpg>; rel=\"http://fedora.info/definitions/fcrepo#ExternalContent\"; handling=\"redirect\"; type=\"image/jp2\"" -XPUT -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/redirect_remote_file

Run the import-export-utility, specifying that external content should be retrieved

java -jar target/fcrepo-import-export-1.1.0-SNAPSHOT.jar -b -V -x -d external-content-retrieve -u fedoraAdmin:secret3 -m export -r http://localhost:8080/fcrepo/rest

Verify that the fcrepo headers exist and look accurate

less external-content-retrieve/fcrepo/rest/redirect_remote_file.external.fcrepo.headers