Interface ContentResourceLoader

All Known Implementing Classes:
FileContentResourceLoader, ZipFileContentResourceLoader

public interface ContentResourceLoader
Strategy interface for loading resources (e.g, file system resources, zip entry resources or URI based resources).
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a URL to the resource that is mapped to the given path.
    Returns the resource located at the named path as an InputStream object.
  • Method Details

    • getResource

      URL getResource(String path) throws MalformedURLException
      Returns a URL to the resource that is mapped to the given path.

      The path must begin with a / and is interpreted as relative to the current content root.

      This method returns null if no resource is mapped to the pathname.

      Parameters:
      path - a String specifying the path to the resource
      Returns:
      the resource located at the named path, or null if there is no resource at that path
      Throws:
      MalformedURLException - if the pathname is not given in the correct form
    • getResourceAsStream

      InputStream getResourceAsStream(String path) throws IOException
      Returns the resource located at the named path as an InputStream object.

      The path must be specified according to the rules given in getResource. This method returns null if no resource exists at the specified path.

      Parameters:
      path - a String specifying the path to the resource
      Returns:
      the InputStream returned to the caller, or null if no resource exists at the specified path
      Throws:
      IOException