Class URLResource

java.lang.Object
io.undertow.server.handlers.resource.URLResource
All Implemented Interfaces:
RangeAwareResource, Resource

public class URLResource extends Object implements Resource, RangeAwareResource
Author:
Stuart Douglas
  • Constructor Details

  • Method Details

    • getPath

      public String getPath()
      Specified by:
      getPath in interface Resource
      Returns:
      The path from the resource manager root
    • getLastModified

      public Date getLastModified()
      Specified by:
      getLastModified in interface Resource
      Returns:
      The last modified date of this resource, or null if this cannot be determined
    • getLastModifiedString

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

      public ETag getETag()
      Specified by:
      getETag in interface Resource
      Returns:
      The resources etags
    • getName

      public String getName()
      Specified by:
      getName in interface Resource
      Returns:
      The name of the resource
    • isDirectory

      public boolean isDirectory()
      Specified by:
      isDirectory in interface Resource
      Returns:
      true if this resource represents a directory
    • list

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

      public String getContentType(MimeMappings mimeMappings)
      Description copied from interface: Resource
      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.
      Specified by:
      getContentType in interface Resource
    • serve

      public void serve(Sender sender, HttpServerExchange exchange, IoCallback completionCallback)
      Description copied from interface: Resource
      Serve the resource, and call the provided callback when complete.
      Specified by:
      serve in interface Resource
      Parameters:
      sender - The sender to use.
      exchange - The exchange
    • serveImpl

      public void serveImpl(Sender sender, HttpServerExchange exchange, long start, long end, boolean range, IoCallback completionCallback)
    • getContentLength

      public Long getContentLength()
      Specified by:
      getContentLength in interface Resource
      Returns:
      The content length, or null if it is unknown
    • getCacheKey

      public String getCacheKey()
      Specified by:
      getCacheKey in interface Resource
      Returns:
      A string that uniquely identifies this resource
    • getFile

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

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

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

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

      public URL getUrl()
      Specified by:
      getUrl in interface Resource
      Returns:
      The URL of the resource
    • serveRange

      public void serveRange(Sender sender, HttpServerExchange exchange, long start, long end, IoCallback completionCallback)
      Description copied from interface: RangeAwareResource
      Serve the resource, and call the provided callback when complete.
      Specified by:
      serveRange in interface RangeAwareResource
      Parameters:
      sender - The sender to use.
      exchange - The exchange
    • isRangeSupported

      public boolean isRangeSupported()
      Description copied from interface: RangeAwareResource
      It is possible that some resources managers may only support range requests on a subset of their resources,
      Specified by:
      isRangeSupported in interface RangeAwareResource
      Returns:
      true if this resource supports range requests