public class FileSystemResource extends AbstractResource
FileSystemResourceReference
AbstractResource.ContentRangeType, AbstractResource.ResourceResponse, AbstractResource.WriteCallback
IResource.Attributes
CONTENT_DISPOSITION_HEADER_NAME, CONTENT_RANGE_ENDBYTE, CONTENT_RANGE_STARTBYTE, INTERNAL_HEADERS
Constructor and Description |
---|
FileSystemResource()
Creates a new file system resource
|
FileSystemResource(Path path)
Creates a new file system resource based on the given path
|
Modifier and Type | Method and Description |
---|---|
protected AbstractResource.ResourceResponse |
createResourceResponse(IResource.Attributes attributes,
Path path)
Creates a resource response based on the given attributes
|
protected InputStream |
getInputStream()
Gets the input stream of the given path
|
protected String |
getMimeType()
Gets the mime type to be used for the response it first uses the URL connection to get the
mime type and after this the FileTypeDetector SPI is used.
|
protected long |
getSize()
Gets the size of the resource
|
protected AbstractResource.ResourceResponse |
newResourceResponse(IResource.Attributes attributes)
Creates a new resource response and reads the given path
|
void |
respond(IResource.Attributes attributes)
Renders this resource to response using the provided attributes.
|
configureCache, getCachingStrategy, setRequestMetaData, setRequestRangeMetaData, setResponseContentRangeHeaderFields, setResponseHeaders
public FileSystemResource(Path path)
path
- the path to be read for the resourcepublic FileSystemResource()
protected AbstractResource.ResourceResponse newResourceResponse(IResource.Attributes attributes)
newResourceResponse
in class AbstractResource
attributes
- request attributespublic void respond(IResource.Attributes attributes)
IResource
respond
in interface IResource
respond
in class AbstractResource
IResource.respond(org.apache.wicket.request.resource.IResource.Attributes)
protected AbstractResource.ResourceResponse createResourceResponse(IResource.Attributes attributes, Path path)
path
- the path to create the resource response withattributes
- request attributesprotected long getSize() throws IOException
IOException
- if the size attribute can't be readprotected String getMimeType() throws IOException
IOException
- if the mime type couldn't be resolvedprotected InputStream getInputStream() throws IOException
IOException
- if there is an exception while receiving the input streamCopyright © 2006–2022 Apache Software Foundation. All rights reserved.