Package org.dspace.app.rest.utils
Class HttpHeadersInitializer
- java.lang.Object
-
- org.dspace.app.rest.utils.HttpHeadersInitializer
-
public class HttpHeadersInitializer extends Object
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 ofHttpHeadersto be used in the response that'll be generated
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTENT_DISPOSITION_ATTACHMENTstatic StringCONTENT_DISPOSITION_INLINEprotected org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description HttpHeadersInitializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.HttpHeadersinitialiseHeaders()This 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.HttpHeadersInitializerwith(javax.servlet.http.HttpServletRequest httpRequest)HttpHeadersInitializerwith(javax.servlet.http.HttpServletResponse httpResponse)HttpHeadersInitializerwithBufferSize(int bufferSize)HttpHeadersInitializerwithChecksum(String checksum)HttpHeadersInitializerwithDisposition(String contentDisposition)HttpHeadersInitializerwithFileName(String fileName)HttpHeadersInitializerwithLastModified(long lastModified)HttpHeadersInitializerwithLength(long length)HttpHeadersInitializerwithMimetype(String mimetype)
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
CONTENT_DISPOSITION_INLINE
public static final String CONTENT_DISPOSITION_INLINE
- See Also:
- Constant Field Values
-
CONTENT_DISPOSITION_ATTACHMENT
public static final String CONTENT_DISPOSITION_ATTACHMENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
with
public HttpHeadersInitializer with(javax.servlet.http.HttpServletRequest httpRequest)
-
with
public HttpHeadersInitializer with(javax.servlet.http.HttpServletResponse httpResponse)
-
withLength
public HttpHeadersInitializer withLength(long length)
-
withFileName
public HttpHeadersInitializer withFileName(String fileName)
-
withChecksum
public HttpHeadersInitializer withChecksum(String checksum)
-
withMimetype
public HttpHeadersInitializer withMimetype(String mimetype)
-
withLastModified
public HttpHeadersInitializer withLastModified(long lastModified)
-
withBufferSize
public HttpHeadersInitializer withBufferSize(int bufferSize)
-
withDisposition
public HttpHeadersInitializer withDisposition(String contentDisposition)
-
initialiseHeaders
public org.springframework.http.HttpHeaders initialiseHeaders() throws IOExceptionThis 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
public boolean isValid() throws IOExceptionThis 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
-
-