public class SystemFile extends java.lang.Object implements FileCustomizableResponseType
File instances to the client. More efficient
than StreamedFile.ATTACHMENT_HEADER| Constructor and Description |
|---|
SystemFile(java.io.File file) |
SystemFile(java.io.File file,
io.micronaut.http.MediaType mediaType) |
| Modifier and Type | Method and Description |
|---|---|
SystemFile |
attach()
Sets the file to be downloaded as an attachment.
|
SystemFile |
attach(java.lang.String attachmentName)
Sets the file to be downloaded as an attachment.
|
java.io.File |
getFile() |
long |
getLastModified() |
long |
getLength() |
io.micronaut.http.MediaType |
getMediaType() |
void |
process(io.micronaut.http.MutableHttpResponse response)
Modify the response before it is written to the client.
|
public SystemFile(java.io.File file)
file - The file to respond withpublic SystemFile(java.io.File file,
io.micronaut.http.MediaType mediaType)
file - The file to respond withmediaType - The content type of the responsepublic long getLastModified()
getLastModified in interface FileCustomizableResponseTypepublic long getLength()
getLength in interface FileCustomizableResponseTypepublic io.micronaut.http.MediaType getMediaType()
getMediaType in interface FileCustomizableResponseTypepublic java.io.File getFile()
public SystemFile attach()
public SystemFile attach(java.lang.String attachmentName)
attachmentName - The attachment name.public void process(io.micronaut.http.MutableHttpResponse response)
CustomizableResponseTypeprocess in interface CustomizableResponseTyperesponse - The response to modify