Package io.goobi.viewer.controller
Class RestApiManager
java.lang.Object
io.goobi.viewer.controller.RestApiManager
Handles urls to configured rest api endpoints.
Two endpoints are managed: one for data (solr, dao) and one for content (image, ocr, other media) An AbstractApiUrlManager is kept for
both. These can either be injected directly in the constructor or resolved from a Configuration.
In the latter case, data resources url is taken from Configuration.getRestApiUrl(), content resources url is taken from
Configuration.getIIIFApiUrl().
Both urls are updated if the configuration changes. Also, if the configured url contains '/rest' that part is rewritten to '/api/v1' if the
rewritten url points to a goobi viewer v1 rest api.
- Author:
- Florian Alpers
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance directly using the unchanged given ApiUrlManagers.RestApiManager(Configuration config) Creates an instance based on configuration. -
Method Summary
-
Constructor Details
-
RestApiManager
public RestApiManager()Creates an instance directly using the unchanged given ApiUrlManagers. -
RestApiManager
Creates an instance based on configuration. Final urls may change from configured ones- Parameters:
config- the viewer configuration to read API URLs from
-
-
Method Details
-
getDataApiManager
- Returns:
- the dataApiManager if it is either set directly or if the configured rest endpoint points to a goobi viewer v1 rest endpoint. Otherwise Null is returned
-
getDataApiManager
-
getDataApiUrl
- Returns:
- The url to the data api. Either
AbstractApiUrlManager.getApiUrl()of thegetDataApiManager()if it exists, or else the ConfiguredConfiguration.getRestApiUrl()
-
getContentApiUrl
- Returns:
- The url to the content api. Either
AbstractApiUrlManager.getApiUrl()of thegetContentApiManager()if it exists, or Else the configuredConfiguration.getIIIFApiUrl()
-
getContentApiManager
- Returns:
- the contentApiManager if it is either set directly or if the configured rest endpoint points to a goobi viewer v1 rest endpoint. Otherwise null is returned
-
getContentApiManager
-
getCMSMediaImageApiManager
-
getCMSMediaImageApiManager
-
isLegacyUrl
- Parameters:
restApiUrl- the REST API URL to check- Returns:
- true if restApiUrl is legacy URL; false otherwise
-
getIIIFDataApiUrl
- Returns:
- the url to the data api to use for IIIF resources
-
getIIIFContentApiUrl
- Returns:
- the url to the content api to use for IIIF resources
-
getIIIFContentApiUrl
- Parameters:
version- the API version to use- Returns:
- the url to the content api to use for IIIF resources
-
getIIIFDataApiManager
-
getIIIFContentApiManager
-
getVersionToUseForIIIF
- Returns:
- Appropriate API version to use for IIIF
-