Class ClasspathResourceSystem

  • All Implemented Interfaces:
    ResourceSystem

    public class ClasspathResourceSystem
    extends java.lang.Object
    implements ResourceSystem
    Locates a HttpFile from a ClassLoader.
    Author:
    Daniel Sagenschneider
    • Constructor Detail

      • ClasspathResourceSystem

        public ClasspathResourceSystem​(ResourceSystemContext context,
                                       java.lang.ClassLoader classLoader)
                                throws java.io.IOException
        Instantiate.
        Parameters:
        context - ResourceSystemContext.
        classLoader - ClassLoader.
        Throws:
        java.io.IOException - If fails to initiate resources from the class path.
    • Method Detail

      • getNode

        public ClassPathNode getNode​(java.lang.String path)
        Obtains the ClassPathNode for resource path.
        Parameters:
        path - Resource path.
        Returns:
        ClassPathNode for resource path or null if no resource.
      • getResource

        public java.nio.file.Path getResource​(java.lang.String path)
                                       throws java.io.IOException
        Description copied from interface: ResourceSystem
        Obtains the Path to the resource.
        Specified by:
        getResource in interface ResourceSystem
        Parameters:
        path - Path for the resource.
        Returns:
        Path if resource found, otherwise null.
        Throws:
        java.io.IOException - If failure in obtaining Path.