public abstract class TaskFileStoreAdapter<T extends util.object.Identifiable>
extends java.lang.Object
TaskFileStore
available to web clients.Constructor and Description |
---|
TaskFileStoreAdapter() |
Modifier and Type | Method and Description |
---|---|
protected java.util.function.Consumer<javax.servlet.http.HttpServletResponse> |
cacheStrategy() |
org.springframework.http.ResponseEntity<java.lang.Void> |
deleteFile(java.lang.String taskId)
Removes the file associated to a task if it is in the store; does nothing
otherwise.
|
protected org.springframework.http.MediaType |
filesContentType() |
java.lang.String[] |
listTaskFileUrlPaths() |
protected abstract java.lang.String |
rootPath() |
protected abstract TaskFileStore<T> |
service() |
org.springframework.http.ResponseEntity<java.lang.String> |
streamFileOr404(java.lang.String taskId,
javax.servlet.http.HttpServletResponse response)
Looks up the file associated to a task using the task ID and streams that
file to the client if found; otherwise outputs a 404 to the client.
|
protected abstract java.util.function.Function<java.lang.String,T> |
taskIdFromString() |
protected abstract TaskFileStore<T> service()
protected abstract java.lang.String rootPath()
protected abstract java.util.function.Function<java.lang.String,T> taskIdFromString()
protected org.springframework.http.MediaType filesContentType()
protected java.util.function.Consumer<javax.servlet.http.HttpServletResponse> cacheStrategy()
Caches
@RequestMapping(method=GET, produces="application/json") public java.lang.String[] listTaskFileUrlPaths()
@RequestMapping(method=GET, value="{taskId}") public org.springframework.http.ResponseEntity<java.lang.String> streamFileOr404(@PathVariable(value="taskId") java.lang.String taskId, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
taskId
- the ID of the task associated to the file.response
- the response to use to stream the file.java.io.IOException
- If an error occurs while reading and streaming the
file.@RequestMapping(method=DELETE, value="{taskId}") public org.springframework.http.ResponseEntity<java.lang.Void> deleteFile(@PathVariable(value="taskId") java.lang.String taskId)
taskId
- the ID of the task associated to the file.