Package com.jk.web.util
Class JKServletResourceLoader
java.lang.Object
com.jk.core.resources.JKDefaultResourceLoader
com.jk.web.util.JKServletResourceLoader
- All Implemented Interfaces:
JKResourceLoader
This class extends
JKDefaultResourceLoader and provides resource
loading capabilities within a servlet context.- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
ConstructorsConstructorDescriptionJKServletResourceLoader(jakarta.servlet.ServletContext context) This method constructs a newJKServletResourceLoaderwith the specified servlet context. -
Method Summary
Modifier and TypeMethodDescriptiongetResourceAsStream(String resourceName) This method retrieve anInputStreamfor reading the specified resource.getResourceUrl(String fileName) This method retrieve a URL pointing to the location of the specified file resource.
-
Constructor Details
-
JKServletResourceLoader
@Autowired public JKServletResourceLoader(jakarta.servlet.ServletContext context) This method constructs a newJKServletResourceLoaderwith the specified servlet context.- Parameters:
context- Specifies the servlet context.
-
-
Method Details
-
getResourceAsStream
This method retrieve anInputStreamfor reading the specified resource.- Specified by:
getResourceAsStreamin interfaceJKResourceLoader- Overrides:
getResourceAsStreamin classJKDefaultResourceLoader- Parameters:
resourceName- Specifies the name of the resource to be retrieved.- Returns:
- an
InputStreamfor reading the resource, or null if the resource is not found.
-
getResourceUrl
This method retrieve a URL pointing to the location of the specified file resource.- Specified by:
getResourceUrlin interfaceJKResourceLoader- Overrides:
getResourceUrlin classJKDefaultResourceLoader- 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.
-