Class FileSystemResource

    • Constructor Detail

      • FileSystemResource

        public FileSystemResource​(java.nio.file.Path path)
        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 Detail

      • createResourceResponse

        protected AbstractResource.ResourceResponse createResourceResponse​(IResource.Attributes attributes,
                                                                           java.nio.file.Path path)
        Creates a resource response based on the given attributes
        Parameters:
        path - the path to create the resource response with
        attributes - request attributes
        Returns:
        the actual resource response
      • getSize

        protected long getSize()
                        throws java.io.IOException
        Gets the size of the resource
        Returns:
        the size of the resource
        Throws:
        java.io.IOException - if the size attribute can't be read
      • getMimeType

        protected java.lang.String getMimeType()
                                        throws java.io.IOException
        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:
        java.io.IOException - if the mime type couldn't be resolved
      • getInputStream

        protected java.io.InputStream getInputStream()
                                              throws java.io.IOException
        Gets the input stream of the given path
        Returns:
        the input stream of the given path
        Throws:
        java.io.IOException - if there is an exception while receiving the input stream