Class HttpFileImpl

    • Constructor Detail

      • HttpFileImpl

        public HttpFileImpl​(java.lang.String path,
                            java.nio.file.Path cleanupResourcePath,
                            java.nio.channels.FileChannel file,
                            HttpHeaderValue contentEncoding,
                            HttpHeaderValue contentType,
                            java.nio.charset.Charset charset)
        Initiate an existing HttpFile.
        path - Path.
        cleanupResourcePath - Resource Path to clean up. May be null.
        file - FileChannel to the file.
        contentEncoding - Content-Encoding.
        contentType - Content-Type.
        charset - Charset.
    • Method Detail

      • getCharset

        public java.nio.charset.Charset getCharset()
        Description copied from interface: HttpFile
        Obtains the Charset for the contents.
        Specified by:
        getCharset in interface HttpFile
        Charset or null if contents are not text or the Charset is unknown.
        See Also:
        ResourceSystem, ResourceSystemContext
      • complete

        public void complete​(java.nio.channels.FileChannel file,
                             boolean isWritten)
        Description copied from interface: FileCompleteCallback

        Invoked on completion of writing the FileChannel content.

        Note that may also be invoked if content was not written (rather cancelled).

        Typical use is to close the FileChannel once complete.

        WARNING: this is typically invoked on the SocketChannel Thread so should not invoke any long running operations.

        Specified by:
        complete in interface FileCompleteCallback
        file - FileChannel from the write.
        isWritten - true indicates whether written, while false indicates cancelled.
        Throws: - If issue in interacting with FileChannel.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface