Class UniversalClasspathResource

java.lang.Object
org.eclipse.jetty.util.resource.Resource
jadex.publishservicejetty.impl.UniversalClasspathResource
All Implemented Interfaces:
Closeable, AutoCloseable, org.eclipse.jetty.util.resource.ResourceFactory

public class UniversalClasspathResource extends org.eclipse.jetty.util.resource.Resource
Single resource that can handle all items in classpath.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected File
    File cached for speed.
    protected String
    The path of the resource (relative to classpath, e.g.
    protected URL
    URL cached for speed.

    Fields inherited from class org.eclipse.jetty.util.resource.Resource

    __defaultUseCaches
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a resource for the given path in classpath.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.eclipse.jetty.util.resource.Resource
     
    protected File
    File representation of resource, including entries inside jar files.
    void
     
    boolean
     
    boolean
     
     
     
     
     
     
     
    boolean
    isContainedIn(org.eclipse.jetty.util.resource.Resource r)
     
    boolean
     
    long
     
    long
     
     
    boolean
    renameTo(org.eclipse.jetty.util.resource.Resource dest)
     

    Methods inherited from class org.eclipse.jetty.util.resource.Resource

    copyTo, fromList, fromList, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getResource, getWeakETag, getWeakETag, isAlias, isContainedIn, isSame, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, setAssociate, setDefaultUseCaches, toURL

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • path

      protected String path
      The path of the resource (relative to classpath, e.g. package directory).
    • url

      protected URL url
      URL cached for speed.
    • file

      protected File file
      File cached for speed.
  • Constructor Details

    • UniversalClasspathResource

      public UniversalClasspathResource(String rootpath)
      Create a resource for the given path in classpath.
  • Method Details

    • addPath

      public org.eclipse.jetty.util.resource.Resource addPath(String path) throws IOException, MalformedURLException
      Specified by:
      addPath in class org.eclipse.jetty.util.resource.Resource
      Throws:
      IOException
      MalformedURLException
    • getURL

      public URL getURL()
    • getURI

      public URI getURI()
      Specified by:
      getURI in class org.eclipse.jetty.util.resource.Resource
    • isContainedIn

      public boolean isContainedIn(org.eclipse.jetty.util.resource.Resource r) throws MalformedURLException
      Specified by:
      isContainedIn in class org.eclipse.jetty.util.resource.Resource
      Throws:
      MalformedURLException
    • isDirectory

      public boolean isDirectory()
      Specified by:
      isDirectory in class org.eclipse.jetty.util.resource.Resource
    • lastModified

      public long lastModified()
      Specified by:
      lastModified in class org.eclipse.jetty.util.resource.Resource
    • length

      public long length()
      Specified by:
      length in class org.eclipse.jetty.util.resource.Resource
    • list

      public String[] list()
      Specified by:
      list in class org.eclipse.jetty.util.resource.Resource
    • renameTo

      public boolean renameTo(org.eclipse.jetty.util.resource.Resource dest) throws SecurityException
      Specified by:
      renameTo in class org.eclipse.jetty.util.resource.Resource
      Throws:
      SecurityException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class org.eclipse.jetty.util.resource.Resource
    • delete

      public boolean delete() throws SecurityException
      Specified by:
      delete in class org.eclipse.jetty.util.resource.Resource
      Throws:
      SecurityException
    • exists

      public boolean exists()
      Specified by:
      exists in class org.eclipse.jetty.util.resource.Resource
    • asFile

      protected File asFile() throws IOException
      File representation of resource, including entries inside jar files.
      Throws:
      IOException
    • getFile

      public File getFile() throws IOException
      Specified by:
      getFile in class org.eclipse.jetty.util.resource.Resource
      Throws:
      IOException
    • getInputStream

      public InputStream getInputStream() throws IOException
      Specified by:
      getInputStream in class org.eclipse.jetty.util.resource.Resource
      Throws:
      IOException
    • getName

      public String getName()
      Specified by:
      getName in class org.eclipse.jetty.util.resource.Resource
    • getReadableByteChannel

      public ReadableByteChannel getReadableByteChannel() throws IOException
      Specified by:
      getReadableByteChannel in class org.eclipse.jetty.util.resource.Resource
      Throws:
      IOException