Package org.dspace.app.rest.utils
Class BitstreamResourceAccessByToken
java.lang.Object
org.springframework.core.io.AbstractResource
org.dspace.app.rest.utils.BitstreamResource
org.dspace.app.rest.utils.BitstreamResourceAccessByToken
- All Implemented Interfaces:
InputStreamSource,Resource
This class acts as a
AbstractResource used by Spring's framework to send the data in a proper and
streamlined way inside the ResponseEntity body.
This class' attributes are being used by Spring's framework in the overridden methods so that the proper
attributes are given and used in the response.
Unlike the BitstreamResource, this resource expects a valid and authorised access token to use when
retrieving actual bitstream data. It will either set a special group in the temp context for READ of the
bitstream, or turn off authorisation for the lifetime of the temp (autocloseable in try-with-resources) context- Author:
- Kim Shepherd
-
Field Summary
Fields inherited from class org.dspace.app.rest.utils.BitstreamResource
bitstreamService, citationDocumentService, currentSpecialGroups, currentUserUUID, document, ePersonService, name, shouldGenerateCoverPage, uuid -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidGet the bitstream content using the special temporary context if the request-a-copy access request is properly authenticated and authorised.Methods inherited from class org.dspace.app.rest.utils.BitstreamResource
contentLength, getChecksum, getDescription, getFilename, getInputStreamMethods inherited from class org.springframework.core.io.AbstractResource
createRelative, equals, exists, getFile, getFileForLastModifiedCheck, getURI, getURL, hashCode, isFile, isOpen, isReadable, lastModified, readableChannel, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.io.Resource
getContentAsByteArray, getContentAsString
-
Constructor Details
-
BitstreamResourceAccessByToken
-
-
Method Details
-
fetchDocument
public void fetchDocument()Get the bitstream content using the special temporary context if the request-a-copy access request is properly authenticated and authorised. After this method is called, the bitstream content is updated so the correct input stream can be returned- Throws:
IOException
-