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,
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() |
MediaType |
getMediaType() |
void |
process(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, MediaType mediaType)
file
- The file to respond withmediaType
- The content type of the responsepublic long getLastModified()
getLastModified
in interface FileCustomizableResponseType
public long getLength()
getLength
in interface FileCustomizableResponseType
public MediaType getMediaType()
getMediaType
in interface FileCustomizableResponseType
public java.io.File getFile()
public SystemFile attach()
public SystemFile attach(java.lang.String attachmentName)
attachmentName
- The attachment name.public void process(MutableHttpResponse response)
CustomizableResponseType
process
in interface CustomizableResponseType
response
- The response to modify