Class JKServletResourceLoader

java.lang.Object
com.jk.core.resources.JKDefaultResourceLoader
com.jk.web.util.JKServletResourceLoader
All Implemented Interfaces:
JKResourceLoader

public class JKServletResourceLoader extends JKDefaultResourceLoader
This class extends JKDefaultResourceLoader and provides resource loading capabilities within a servlet context.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Details

    • JKServletResourceLoader

      @Autowired public JKServletResourceLoader(jakarta.servlet.ServletContext context)
      This method constructs a new JKServletResourceLoader with the specified servlet context.
      Parameters:
      context - Specifies the servlet context.
  • Method Details

    • getResourceAsStream

      public InputStream getResourceAsStream(String resourceName)
      This method retrieve an InputStream for reading the specified resource.
      Specified by:
      getResourceAsStream in interface JKResourceLoader
      Overrides:
      getResourceAsStream in class JKDefaultResourceLoader
      Parameters:
      resourceName - Specifies the name of the resource to be retrieved.
      Returns:
      an InputStream for reading the resource, or null if the resource is not found.
    • getResourceUrl

      public URL getResourceUrl(String fileName)
      This method retrieve a URL pointing to the location of the specified file resource.
      Specified by:
      getResourceUrl in interface JKResourceLoader
      Overrides:
      getResourceUrl in class JKDefaultResourceLoader
      Parameters:
      fileName - Specifies the name of the file resource to be located.
      Returns:
      a URL representing the location of the resource, or null if the resource is not found.