Package org.dspace.app.rest.utils
Class MultipartFileSender
- java.lang.Object
-
- org.dspace.app.rest.utils.MultipartFileSender
-
public class MultipartFileSender extends Object
Utility class to send an input stream with Range header and ETag support. Based on https://github.com/davinkevin/Podcast-Server/blob/v1.0.0/src/main/java/lan/dk/podcastserver/service /MultiPartFileSenderService.java- Author:
- Tom Desair (tom dot desair at atmire dot com), Frederic Van Reet (frederic dot vanreet at atmire dot com)
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTENT_DISPOSITION_ATTACHMENTstatic StringCONTENT_DISPOSITION_INLINEprotected org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description MultipartFileSender(InputStream inputStream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MultipartFileSenderfromInputStream(InputStream inputStream)booleanisNoRangeRequest()booleanisValid()voidserveResource()MultipartFileSenderwith(javax.servlet.http.HttpServletRequest httpRequest)MultipartFileSenderwith(javax.servlet.http.HttpServletResponse httpResponse)MultipartFileSenderwithBufferSize(int bufferSize)MultipartFileSenderwithChecksum(String checksum)MultipartFileSenderwithDisposition(String contentDisposition)MultipartFileSenderwithFileName(String fileName)MultipartFileSenderwithLastModified(long lastModified)MultipartFileSenderwithLength(long length)MultipartFileSenderwithMimetype(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
-
-
Constructor Detail
-
MultipartFileSender
public MultipartFileSender(InputStream inputStream)
-
-
Method Detail
-
fromInputStream
public static MultipartFileSender fromInputStream(InputStream inputStream)
-
with
public MultipartFileSender with(javax.servlet.http.HttpServletRequest httpRequest)
-
with
public MultipartFileSender with(javax.servlet.http.HttpServletResponse httpResponse)
-
withLength
public MultipartFileSender withLength(long length)
-
withFileName
public MultipartFileSender withFileName(String fileName)
-
withChecksum
public MultipartFileSender withChecksum(String checksum)
-
withMimetype
public MultipartFileSender withMimetype(String mimetype)
-
withLastModified
public MultipartFileSender withLastModified(long lastModified)
-
withBufferSize
public MultipartFileSender withBufferSize(int bufferSize)
-
withDisposition
public MultipartFileSender withDisposition(String contentDisposition)
-
serveResource
public void serveResource() throws IOException- Throws:
IOException
-
isValid
public boolean isValid() throws IOException- Throws:
IOException
-
isNoRangeRequest
public boolean isNoRangeRequest() throws IOException- Throws:
IOException
-
-