java.lang.Object
org.apache.wicket.request.resource.AbstractResource
org.apache.wicket.resource.FileSystemResource
- All Implemented Interfaces:
Serializable
,IResource
,IClusterable
Used to provide resources based on the on Java NIO FileSystem API.
For more information see
For more information see
FileSystemResourceReference
- Author:
- Tobias Soloschenko
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.AbstractResource
AbstractResource.ContentRangeType, AbstractResource.ResourceResponse, AbstractResource.WriteCallback
Nested classes/interfaces inherited from interface org.apache.wicket.request.resource.IResource
IResource.Attributes
-
Field Summary
Fields inherited from class org.apache.wicket.request.resource.AbstractResource
CONTENT_DISPOSITION_HEADER_NAME, CONTENT_RANGE_ENDBYTE, CONTENT_RANGE_STARTBYTE, INTERNAL_HEADERS
-
Constructor Summary
ConstructorDescriptionCreates a new file system resourceFileSystemResource
(Path path) Creates a new file system resource based on the given path -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractResource.ResourceResponse
createResourceResponse
(IResource.Attributes attributes, Path path) Creates a resource response based on the given attributesprotected InputStream
Gets the input stream of the given pathprotected String
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 resourceprotected AbstractResource.ResourceResponse
newResourceResponse
(IResource.Attributes attributes) Creates a new resource response and reads the given pathvoid
respond
(IResource.Attributes attributes) Renders this resource to response using the provided attributes.Methods inherited from class org.apache.wicket.request.resource.AbstractResource
configureCache, getCachingStrategy, setRequestMetaData, setRequestRangeMetaData, setResponseContentRangeHeaderFields, setResponseHeaders
-
Constructor Details
-
FileSystemResource
Creates a new file system resource based on the given path- Parameters:
path
- the path to be read for the resource
-
FileSystemResource
public FileSystemResource()Creates a new file system resource
-
-
Method Details
-
newResourceResponse
Creates a new resource response and reads the given path- Specified by:
newResourceResponse
in classAbstractResource
- Parameters:
attributes
- request attributes- Returns:
- resource data instance
-
respond
Description copied from interface:IResource
Renders this resource to response using the provided attributes.- Specified by:
respond
in interfaceIResource
- Overrides:
respond
in classAbstractResource
- See Also:
-
createResourceResponse
protected AbstractResource.ResourceResponse createResourceResponse(IResource.Attributes attributes, Path path) Creates a resource response based on the given attributes- Parameters:
path
- the path to create the resource response withattributes
- request attributes- Returns:
- the actual resource response
-
getSize
Gets the size of the resource- Returns:
- the size of the resource
- Throws:
IOException
- if the size attribute can't be read
-
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.- Returns:
- the mime type to be used for the response
- Throws:
IOException
- if the mime type couldn't be resolved
-
getInputStream
Gets the input stream of the given path- Returns:
- the input stream of the given path
- Throws:
IOException
- if there is an exception while receiving the input stream
-