Interface WebResource

All Known Implementing Classes:
AbstractArchiveResource, AbstractResource, AbstractSingleArchiveResource, CachedResource, EmptyResource, FileResource, JarResource, JarResourceRoot, JarWarResource, VirtualResource, WarResource

public interface WebResource
Represents a file or directory within a web application. It borrows heavily from File.
  • Method Details Link icon

    • getLastModified Link icon

      long getLastModified()
      Returns:
      File.lastModified().
    • getLastModifiedHttp Link icon

      String getLastModifiedHttp()
      Returns:
      the last modified time of this resource in the correct format for the HTTP Last-Modified header as specified by RFC 2616.
    • exists Link icon

      boolean exists()
      Returns:
      File.exists().
    • isVirtual Link icon

      boolean isVirtual()
      Indicates if this resource is required for applications to correctly scan the file structure but that does not exist in either the main or any additional WebResourceSet. For example, if an external directory is mapped to /WEB-INF/lib in an otherwise empty web application, /WEB-INF will be represented as a virtual resource.
      Returns:
      true for a virtual resource
    • isDirectory Link icon

      boolean isDirectory()
      Returns:
      File.isDirectory().
    • isFile Link icon

      boolean isFile()
      Returns:
      File.isFile().
    • delete Link icon

      boolean delete()
      Returns:
      File.delete().
    • getName Link icon

      String getName()
      Returns:
      File.getName().
    • getContentLength Link icon

      long getContentLength()
      Returns:
      File.length().
    • getCanonicalPath Link icon

      String getCanonicalPath()
      Returns:
      File.getCanonicalPath().
    • canRead Link icon

      boolean canRead()
      Returns:
      File.canRead().
    • getWebappPath Link icon

      String getWebappPath()
      Returns:
      The path of this resource relative to the web application root. If the resource is a directory, the return value will end in '/'.
    • getETag Link icon

      String getETag()
      Return the weak ETag calculated from the content length and last modified.
      Returns:
      The ETag for this resource
    • getStrongETag Link icon

      default String getStrongETag()
      Return the strong ETag if available else return the weak ETag calculated from the content length and last modified.
      Returns:
      The ETag for this resource
    • setMimeType Link icon

      void setMimeType(String mimeType)
      Set the MIME type for this Resource.
      Parameters:
      mimeType - The mime type that will be associated with the resource
    • getMimeType Link icon

      String getMimeType()
      Returns:
      the MIME type for this Resource.
    • getInputStream Link icon

      InputStream getInputStream()
      Obtain an InputStream based on the contents of this resource.
      Returns:
      An InputStream based on the contents of this resource or null if the resource does not exist or does not represent a file
    • getContent Link icon

      byte[] getContent()
      Returns:
      the binary content of this resource or null if it is not available in a byte[] because, for example, it is too big.
    • getCreation Link icon

      long getCreation()
      Returns:
      The time the file was created. If not available, the result of getLastModified() will be returned.
    • getURL Link icon

      URL getURL()
      Returns:
      a URL to access the resource or null if no such URL is available or if the resource does not exist.
    • getCodeBase Link icon

      URL getCodeBase()
      Returns:
      the code base for this resource that will be used when looking up the assigned permissions for the code base in the security policy file when running under a security manager.
    • getWebResourceRoot Link icon

      WebResourceRoot getWebResourceRoot()
      Returns:
      a reference to the WebResourceRoot of which this WebResource is a part.
    • getCertificates Link icon

      Certificate[] getCertificates()
      Returns:
      the certificates that were used to sign this resource to verify it or @null if none.
      See Also:
    • getManifest Link icon

      Manifest getManifest()
      Returns:
      the manifest associated with this resource or @null if none.
      See Also: