HttpSource ScriptLookupStrategy - multiple http sources in single Cantaloupe? #452
-
Hi everyone, We are running an instance of Cantaloupe using HttpSource to fetch images from a restful API, but we have multiple APIs from different systems so I'm wondering if we might be able to target multiple HttpSource endpoints in a single Cantaloupe, or do we have to run multiple Cantaloupe instances, one per endpoint. I had a look through the documentation for HttpSource https://cantaloupe-project.github.io/manual/5.0/sources.html#HttpSource and in particular the ScriptLookupStrategy. It seems that this method is used to lookup filepath / identifiers within a single HttpSource, but not to lookup which one of multiple http sources to use, based for example on identifier syntax. So I don't think it is possible to have one Cantaloupe that targets multiple API endpoints, and routes the request via that ScriptLookupStrategy. But maybe I'm wrong? All the best, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
"HttpSource" is the name of a component inside Cantaloupe. It doesn't refer to "an HTTP source." The same HttpSource can access any number of HTTP sources/servers. There are two ways to make that work:
|
Beta Was this translation helpful? Give feedback.
"HttpSource" is the name of a component inside Cantaloupe. It doesn't refer to "an HTTP source." The same HttpSource can access any number of HTTP sources/servers. There are two ways to make that work:
Using BasicLookupStrategy, set
HttpSource.BasicLookupStrategy.url_prefix
to nothing and provide the encoded full source URL as the image identifier, for example: http://my-cantaloupe-server/iiif/2/http%3A%2F%2Fmy-images.org%2Fimage.jpg/info.jsonUsing ScriptLookupStrategy, analyze the identifier in the
httpsource_resource_info()
method of yourdelegates.rb
file. It can return any URL including different hosts for different identifiers.