Package org.dspace.app.rest.utils
Class HttpHeadersInitializer
java.lang.Object
org.dspace.app.rest.utils.HttpHeadersInitializer
This class takes data from the Bitstream/File that has to be send. It'll then digest this input and save it in
its local variables.
When calling {
initialiseHeaders()}, the input and information will be used to set the proper headers
with this info and return an Object of HttpHeaders to be used in the response that'll be generated-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method will be called to create aHttpHeadersobject which will contain the headers needed to form a proper response when returning the Bitstream/FilebooleanisValid()This method will validate whether or not the given Response/Request/Information/Variables are valid.with(jakarta.servlet.http.HttpServletRequest httpRequest) with(jakarta.servlet.http.HttpServletResponse httpResponse) withBufferSize(int bufferSize) withChecksum(String checksum) withDisposition(String contentDisposition) withFileName(String fileName) withLastModified(long lastModified) withLength(long length) withMimetype(String mimetype)
-
Field Details
-
log
protected final org.apache.logging.log4j.Logger log -
CONTENT_DISPOSITION_INLINE
- See Also:
-
CONTENT_DISPOSITION_ATTACHMENT
- See Also:
-
CONTENT_DISPOSITION
- See Also:
-
-
Constructor Details
-
HttpHeadersInitializer
public HttpHeadersInitializer()
-
-
Method Details
-
with
-
with
-
withLength
-
withFileName
-
withChecksum
-
withMimetype
-
withLastModified
-
withBufferSize
-
withDisposition
-
initialiseHeaders
This method will be called to create aHttpHeadersobject which will contain the headers needed to form a proper response when returning the Bitstream/File- Returns:
- A
HttpHeadersobject containing the information for the Bitstream/File to be sent - Throws:
IOException- If something goes wrong
-
isValid
This method will validate whether or not the given Response/Request/Information/Variables are valid. If they're invalid, the Response shouldn't be given. This will do null checks on the response, request, inputstream and filename. Other than this, it'll check Request headers to see if their information is correct.- Returns:
- Throws:
IOException
-