Open MarcAgate opened 6 years ago
While digging this issue more and more, I realized that the only way to get a 404 in the actual implementation is the method
public Instant getImageModificationDate(String identifier) throws ResourceNotFoundException
in ImageService. However, ImageService relies on ResourceService to get a resource and ResourceService, whose methods are (among other things) in charge of retreiving resources, only throws ResourceIOException.
We suggest to modify the signatures of the methods retreiving resources in ResourceServices so we can distinguish the reason of the service failure at the client level (and conform to iiif specs).
Here is what we did : https://github.com/BuddhistDigitalResourceCenter/buda-iiif-server/blob/master/src/main/java/de/digitalcollections/core/backend/api/resource/ResourceRepository.java
which leads to the following implementation (using s3 storage): https://github.com/BuddhistDigitalResourceCenter/buda-iiif-server/blob/master/src/main/java/de/digitalcollections/iiif/myhymir/backend/impl/repository/S3ResourceRepositoryImpl.java
(see in particular the implementation of public InputStream getInputStream(Resource r)
)
What do you think ?
you are right. it will be part of upcoming 4.0.0 release
thanks for the fix, will there be also support for 401 and 403? that would be very helpful for the auth API
When I use a wrong identifier in both endpoints of IIIFImageApiController, I get a 500 error instead of the expected 404. Looking at IIIFImageApiController implementation I see that both endpoints return either a 200 code or (if anything fails in ImageService) throw an exception that results in a 500 error. (When the identifier is wrong, the exception comes from getInputStream() method in the ResourceRepository implementation that throws a ResourceIOException).
However, the spec (https://iiif.io/api/image/2.1/#server-responses) says it should return a 400 not found when "The image resource specified by identifier does not exist, the value of one or more of the parameters is not supported for this image, or the requested size is greater than the limits specified."
Am I missing something or is there something here that should be fixed ?