Interface Resource

    • Method Detail

      • getPath

        String getPath()
        Returns:
        The path from the resource manager root
      • getLastModified

        Date getLastModified()
        Returns:
        The last modified date of this resource, or null if this cannot be determined
      • getLastModifiedString

        String getLastModifiedString()
        Returns:
        A string representation of the last modified date, or null if this cannot be determined
      • getETag

        ETag getETag()
        Returns:
        The resources etags
      • getName

        String getName()
        Returns:
        The name of the resource
      • isDirectory

        boolean isDirectory()
        Returns:
        true if this resource represents a directory
      • list

        List<Resource> list()
        Returns:
        a list of resources in this directory
      • getContentType

        String getContentType​(MimeMappings mimeMappings)
        Return the resources content type. In most cases this will simply use the provided mime mappings, however in some cases the resource may have additional information as to the actual content type.
      • serve

        void serve​(Sender sender,
                   HttpServerExchange exchange,
                   IoCallback completionCallback)
        Serve the resource, and call the provided callback when complete.
        Parameters:
        sender - The sender to use.
        exchange - The exchange
      • getContentLength

        Long getContentLength()
        Returns:
        The content length, or null if it is unknown
      • getCacheKey

        String getCacheKey()
        Returns:
        A string that uniquely identifies this resource
      • getFile

        File getFile()
        Returns:
        The underlying file that matches the resource. This may return null if the resource does not map to a file
      • getFilePath

        Path getFilePath()
        Returns:
        The underlying file that matches the resource. This may return null if the resource does not map to a file
      • getResourceManagerRoot

        File getResourceManagerRoot()
        Returns the resource manager root. If the resource manager has multiple roots then this returns the one that is the parent of this resource.
        Returns:
        a file representing the resource manager root. This may return null if the resource does not map to a file
      • getResourceManagerRootPath

        Path getResourceManagerRootPath()
        Returns the resource manager root. If the resource manager has multiple roots then this returns the one that is the parent of this resource.
        Returns:
        a path representing the resource manager root. This may return null if the resource does not map to a file
      • getUrl

        URL getUrl()
        Returns:
        The URL of the resource